-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathSqliteSqlGenerator.cs
29 lines (26 loc) · 983 Bytes
/
SqliteSqlGenerator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Data.Entity.Core.Metadata.Edm;
using SQLite.CodeFirst.Builder;
using SQLite.CodeFirst.Statement;
namespace SQLite.CodeFirst
{
/// <summary>
/// Generates the SQL statement to create a database, based on a <see cref="EdmModel"/>.
/// </summary>
public class SqliteSqlGenerator : ISqlGenerator
{
public SqliteSqlGenerator(Collation defaultCollation = null)
{
DefaultCollation = defaultCollation;
}
public Collation DefaultCollation { get; }
/// <summary>
/// Generates the SQL statement, based on the <see cref="EdmModel"/>.
/// </summary>
public string Generate(EdmModel storeModel)
{
IStatementBuilder<CreateDatabaseStatement> statementBuilder = new CreateDatabaseStatementBuilder(storeModel, DefaultCollation);
IStatement statement = statementBuilder.BuildStatement();
return statement.CreateStatement();
}
}
}