Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
660 changes: 277 additions & 383 deletions Constants/Consts.ipynb

Large diffs are not rendered by default.

458 changes: 191 additions & 267 deletions Constants/Enums.ipynb

Large diffs are not rendered by default.

364 changes: 167 additions & 197 deletions Constants/Validations.ipynb

Large diffs are not rendered by default.

3,890 changes: 1,753 additions & 2,137 deletions DataModel/DataStructure.ipynb

Large diffs are not rendered by default.

218 changes: 90 additions & 128 deletions Database/Configure.ipynb
Original file line number Diff line number Diff line change
@@ -1,131 +1,93 @@
{
"metadata": {
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
"metadata": {
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"authors": [],
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
},
"toc-autonumbering": "True",
"toc-showcode": "False",
"toc-showmarkdowntxt": "False"
},
"toc-autonumbering": "True",
"toc-showcode": "False",
"toc-showmarkdowntxt": "False",
"authors": [],
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
}
},
"nbformat": 4,
"nbformat_minor": 5,
"cells": [
{
"id": "vWKQtrDv20CeZFovAj82Vw",
"cell_type": "markdown",
"source": [
"<p style=\"font-weight:bold;\"> <span style=\"font-size: 36px\"> DataSource Configuration </span> </p>"
],
"metadata": {}
},
{
"id": "ekOMREP2YkKF0vgtOn6cyQ",
"cell_type": "code",
"source": [
"#!import \"../DataModel/DataStructure\""
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "eEI7AS2fc0-CFjAR_WzdHg",
"cell_type": "code",
"source": [
"#!import \"PersonalConnection\""
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "ZoHg5nndvEWdxnUy6nU0aQ",
"cell_type": "code",
"source": [
"using System.Reflection;"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "V3sPPe7bkEOIAjZHtM5oTw",
"cell_type": "markdown",
"source": [
"# Database Configure"
],
"metadata": {}
},
{
"id": "ZxIo5q84i02LBlbq4AQnNA",
"cell_type": "code",
"source": [
"var allTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes())",
"\n .Where(t => (t.IsAssignableTo(typeof(IKeyed)) || t.IsAssignableTo(typeof(KeyedDimension)))",
"\n && !t.IsInterface",
"\n && !t.IsAbstract",
"\n ).ToArray();"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "Wi93Z_KSukSEMiLoOfsKXA",
"cell_type": "code",
"source": [
"await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)",
"\n .WithTypes(allTypes)) .ConnectAsync();"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "4jSr3apQzEm6bXs7ot9uJQ",
"cell_type": "code",
"source": [
"await DataSource.CommitAsync();"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "SUiuO25f-0S6Uv5at0MehA",
"cell_type": "markdown",
"source": [
"# Reset Workspace"
],
"metadata": {}
},
{
"id": "T0pNd11nrkuDwN6S0YgItg",
"cell_type": "code",
"source": [
"Workspace.Reset(x => x.ResetInitializationRules());"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "sAYMeiwmiUWC-T3QYXi7aw",
"cell_type": "code",
"source": [
""
],
"metadata": {},
"execution_count": 1,
"outputs": []
}
]
"nbformat": 4,
"nbformat_minor": 5,
"cells": [
{
"cell_type": "markdown",
"source": [
"<p style=\"font-weight:bold;\"> <span style=\"font-size: 36px\"> DataSource Configuration </span> </p>"
]
},
{
"cell_type": "code",
"source": [
"#!import \"../DataModel/DataStructure\""
]
},
{
"cell_type": "code",
"source": [
"#!import \"PersonalConnection\""
]
},
{
"cell_type": "code",
"source": [
"using System.Reflection;"
]
},
{
"cell_type": "markdown",
"source": [
"# Database Configure"
]
},
{
"cell_type": "code",
"source": [
"var allTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes())",
"\n .Where(t => (t.IsAssignableTo(typeof(IKeyed)) || t.IsAssignableTo(typeof(KeyedDimension)))",
"\n && !t.IsInterface",
"\n && !t.IsAbstract",
"\n ).ToArray();"
]
},
{
"cell_type": "code",
"source": [
"await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)",
"\n .WithTypes(allTypes)) .ConnectAsync();"
]
},
{
"cell_type": "code",
"source": [
"await DataSource.CommitAsync();"
]
},
{
"cell_type": "markdown",
"source": [
"# Reset Workspace"
]
},
{
"cell_type": "code",
"source": [
"Workspace.Reset(x => x.ResetInitializationRules());"
]
},
{
"cell_type": "code",
"source": [
""
]
}
]
}
144 changes: 60 additions & 84 deletions Database/Schema Delete.ipynb
Original file line number Diff line number Diff line change
@@ -1,87 +1,63 @@
{
"metadata": {
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
"metadata": {
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"authors": [],
"documentInfo": "{\r\n \"authors\": [\r\n \"Peter Kunszt\"\r\n ],\r\n \"contributors\": [],\r\n \"tags\": [\r\n \"storage\",\r\n \"database\",\r\n \"persistence\",\r\n \"dependency\"\r\n ],\r\n \"title\": \"Multiple Storages with Persistence\",\r\n \"description\": \"Demo the usage of database backend to resolve a data dependency.\",\r\n \"createdDate\": \"Jan. 2022\",\r\n \"publishedDate\": \"Jan. 2022\",\r\n \"changelog\": [\r\n {\r\n \"version\": \"1.0\",\r\n \"description\": \"Initial Notebook\"\r\n }\r\n ]\r\n }",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
}
},
"authors": [],
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"documentInfo": "{\r\n \"authors\": [\r\n \"Peter Kunszt\"\r\n ],\r\n \"contributors\": [],\r\n \"tags\": [\r\n \"storage\",\r\n \"database\",\r\n \"persistence\",\r\n \"dependency\"\r\n ],\r\n \"title\": \"Multiple Storages with Persistence\",\r\n \"description\": \"Demo the usage of database backend to resolve a data dependency.\",\r\n \"createdDate\": \"Jan. 2022\",\r\n \"publishedDate\": \"Jan. 2022\",\r\n \"changelog\": [\r\n {\r\n \"version\": \"1.0\",\r\n \"description\": \"Initial Notebook\"\r\n }\r\n ]\r\n }"
},
"nbformat": 4,
"nbformat_minor": 5,
"cells": [
{
"id": "XekEwxVoCk6YtMSTaBi_6A",
"cell_type": "code",
"source": [
"#!import \"PersonalConnection\""
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "aMGWTiny-EO8ZtyaiC0M2A",
"cell_type": "code",
"source": [
"#r \"nuget:SqlConnection,1.0.4\""
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "dKBE6yQHq0CZbS4Oq7ZXag",
"cell_type": "code",
"source": [
"string[] split = connectionStringMsSql.Split(new char[] { '=', ':', ',', ';' });",
"\n",
"\nstring serverName = split[2];",
"\nstring database = split[5];",
"\nstring userID = split[9];",
"\nstring password = split[11];"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "BBbDUGWgHUywoxk289vQ2A",
"cell_type": "code",
"source": [
"using SQLConnection;",
"\nusing System;",
"\nusing System.Data.SqlClient;"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "S-_OArgE70qFUpEbX12H3Q",
"cell_type": "code",
"source": [
"string query = \"DECLARE @sql NVARCHAR(max)='' SELECT @sql += ' Drop table ' + QUOTENAME(TABLE_SCHEMA) + '.'+ QUOTENAME(TABLE_NAME) + '; 'FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' Exec Sp_executesql @sql\";"
],
"metadata": {},
"execution_count": 1,
"outputs": []
},
{
"id": "oeQryPr0l0uflGqNrUvmLw",
"cell_type": "code",
"source": [
"int rowAffect = SqlServer.AzureSqlConnection(serverName, database, userID, password, query);"
],
"metadata": {},
"execution_count": 1,
"outputs": []
}
]
"nbformat": 4,
"nbformat_minor": 5,
"cells": [
{
"cell_type": "code",
"source": [
"#!import \"PersonalConnection\""
]
},
{
"cell_type": "code",
"source": [
"#r \"nuget:SqlConnection,1.0.4\""
]
},
{
"cell_type": "code",
"source": [
"string[] split = connectionStringMsSql.Split(new char[] { '=', ':', ',', ';' });",
"\n",
"\nstring serverName = split[2];",
"\nstring database = split[5];",
"\nstring userID = split[9];",
"\nstring password = split[11];"
]
},
{
"cell_type": "code",
"source": [
"using SQLConnection;",
"\nusing System;",
"\nusing System.Data.SqlClient;"
]
},
{
"cell_type": "code",
"source": [
"string query = \"DECLARE @sql NVARCHAR(max)='' SELECT @sql += ' Drop table ' + QUOTENAME(TABLE_SCHEMA) + '.'+ QUOTENAME(TABLE_NAME) + '; 'FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' Exec Sp_executesql @sql\";"
]
},
{
"cell_type": "code",
"source": [
"int rowAffect = SqlServer.AzureSqlConnection(serverName, database, userID, password, query);"
]
}
]
}
Loading