Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Database
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
libraries
Database
Merge requests
!3
An error occurred while fetching the assigned milestone of the selected merge_request.
Topic/122 nuget
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Topic/122 nuget
Topic/122-nuget
into
Product/109-nuget
Overview
0
Commits
6
Pipelines
1
Changes
31
Merged
L. Ellenbeck
requested to merge
Topic/122-nuget
into
Product/109-nuget
6 years ago
Overview
0
Commits
6
Pipelines
1
Changes
31
coscine/issues#122
0
0
Merge request reports
Compare
Product/109-nuget
Product/109-nuget (base)
and
latest version
latest version
50c67f81
6 commits,
6 years ago
31 files
+
353
−
905
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
31
src/Database/DataModel/CsDatabase.tt
+
6
−
52
View file @ 50c67f81
Edit in single-file editor
Open in Web IDE
#region DupFinder Exclusion
<#@ template language="C#" debug="True" hostSpecific="False" #>
<#@ output extension=".generated.cs" #>
<# //@ include file="$(LinqToDBT4SqlServerTemplatesDirectory)LinqToDB.SqlServer.Tools.ttinclude" #>
<# //@ include file="$(LinqToDBT4SqlServerTemplatesDirectory)PluralizationService.ttinclude" #>
<#@ include file="$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" #>
<#@ include file="$(ProjectDir)LinqToDB.Templates\PluralizationService.ttinclude" #>
<#@ include file="$(ProjectDir)DatabaseConnection.t4" #>
<#
/*
1. Create new *.tt file (e.g. MyDatabase.tt) in a folder where you would like to generate your data model
and copy content from this file to it. For example:
MyProject
DataModels
MyDatabase.tt
2. Modify the connection settings below to connect to your database.
3. Add connection string to the web/app.config file:
<connectionStrings>
<add name="MyDatabase" providerName="System.Data.SqlClient"
connectionString="Data Source=.;Database=MyDatabase;User Id=User;Password=TestPassword;" />
</connectionStrings>
4. To access your database use the following code:
using (var db = new MyDatabaseDB())
{
var q =
from c in db.Customers
select c
foreach (var c in q)
Console.WriteLine(c.ContactName);
}
5. See more at https://github.com/linq2db/t4models
If you need to use the Microsoft.SqlServer.Types namespace, install the Microsoft.SqlServer.Types nuget,
and replace the following include at the top of this file:
"$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude"
with
"$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.SqlTypes.Tools.ttinclude"
*/
NamespaceName = "Coscine.Database.Model";
#>
<#@ include file="$(ProjectDir)DatabaseConnection.ttinclude" #>
<# NamespaceName = "Coscine.Database.Model"; #>
<#
DatabaseConnection dbKeys = new DatabaseConnection();
string[] keys = dbKeys.GetConnectionKeys();
LoadSqlServerMetadata(keys[0], keys[1], keys[2], keys[3]);
// LoadSqlServerMetadata(".", "MyDatabase"); // Integrated Security
// LoadSqlServerMetadata(string connectionString);
GenerateModel();
#>
<#@ include file="$(ProjectDir)DataModelConstructor.ttinclude" #>
\ No newline at end of file
<#@ include file="../DataModelConstructor.t4"#>
#endregion
\ No newline at end of file
Loading