解决.NET 4.5与EF6 DatabaseGeneratedOption冲突问题

This commit is contained in:
yubaolee
2015-10-26 23:55:02 +08:00
parent 13d44f28b6
commit 885d444761
16 changed files with 156 additions and 41 deletions

View File

@@ -72,11 +72,11 @@ namespace <#= code.EscapeNamespace(efHost.Namespace) #>
{
if (isKey && storeGeneratedPattern != StoreGeneratedPattern.Identity)
{
configLines.Add(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.None)");
// configLines.Add(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.None)");
}
else if ((!isKey || efHost.EntityType.KeyMembers.Count > 1) && storeGeneratedPattern == StoreGeneratedPattern.Identity)
{
configLines.Add(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)");
// configLines.Add(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)");
}
}

View File

@@ -12,8 +12,7 @@ namespace OpenAuth.Repository.Models.Mapping
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Id);
// Table & Column Mappings
this.ToTable("ModuleRole");

View File

@@ -12,8 +12,7 @@ namespace OpenAuth.Repository.Models.Mapping
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Id);
// Table & Column Mappings
this.ToTable("PageElementGrant");

View File

@@ -11,9 +11,6 @@ namespace OpenAuth.Repository.Models.Mapping
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.DomId)
.IsRequired()

View File

@@ -11,9 +11,6 @@ namespace OpenAuth.Repository.Models.Mapping
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Theme)
.IsRequired()

View File

@@ -11,9 +11,6 @@ namespace OpenAuth.Repository.Models.Mapping
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Email)
.IsRequired()

View File

@@ -11,9 +11,6 @@ namespace OpenAuth.Repository.Models.Mapping
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Account)
.IsRequired()

View File

@@ -11,10 +11,6 @@ namespace OpenAuth.Repository.Models.Mapping
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
this.ToTable("UserModule");
this.Property(t => t.Id).HasColumnName("Id");

View File

@@ -12,8 +12,7 @@ namespace OpenAuth.Repository.Models.Mapping
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Id);
// Table & Column Mappings
this.ToTable("UserOrg");

View File

@@ -12,8 +12,7 @@ namespace OpenAuth.Repository.Models.Mapping
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Id);
// Table & Column Mappings
this.ToTable("UserRole");