本文整理汇总了C#中ModelBuilder.HasDefaultSchema方法的典型用法代码示例。如果您正苦于以下问题:C# ModelBuilder.HasDefaultSchema方法的具体用法?C# ModelBuilder.HasDefaultSchema怎么用?C# ModelBuilder.HasDefaultSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelBuilder
的用法示例。
在下文中一共展示了ModelBuilder.HasDefaultSchema方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.HasDefaultSchema("kraken");
modelBuilder.Entity<ReleaseBatchItem>().HasOne(e => e.Batch).WithMany(e => e.Items).OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<ReleaseBatchItem>().HasAlternateKey(e => new { e.ReleaseBatchId, e.ProjectId });
}
示例2: BuildTargetModel
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasDefaultSchema("mc")
.HasAnnotation("ProductVersion", "1.0.0-rc2-20901")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("MenusSample.Menu", b =>
{
b.Property<int>("MenuId")
.ValueGeneratedOnAdd();
b.Property<int>("MenuCardId");
b.Property<decimal>("Price")
.HasColumnType("Money");
b.Property<string>("Text")
.HasAnnotation("MaxLength", 120);
b.HasKey("MenuId");
b.HasIndex("MenuCardId");
b.ToTable("Menus");
});
modelBuilder.Entity("MenusSample.MenuCard", b =>
{
b.Property<int>("MenuCardId")
.ValueGeneratedOnAdd();
b.Property<string>("Title")
.HasAnnotation("MaxLength", 50);
b.HasKey("MenuCardId");
b.ToTable("MenuCards");
});
modelBuilder.Entity("MenusSample.Menu", b =>
{
b.HasOne("MenusSample.MenuCard")
.WithMany()
.HasForeignKey("MenuCardId")
.OnDelete(DeleteBehavior.Cascade);
});
}
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:48,代码来源:20160522083613_InitMenuCards.Designer.cs
示例3: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.HasDefaultSchema("kraken");
modelBuilder.Entity<ApplicationUser>().HasKey(e => e.UserName);
modelBuilder.Entity<ReleaseBatch>().HasKey(e => e.Id);
modelBuilder.Entity<ReleaseBatch>().HasIndex(e => e.Name).IsUnique();
modelBuilder.Entity<ReleaseBatch>().HasKey(e => e.Id);
modelBuilder.Entity<ReleaseBatchItem>().HasOne(e => e.Batch).WithMany(e => e.Items).OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<ReleaseBatchItem>().HasAlternateKey(e => new { e.ReleaseBatchId, e.ProjectId });
modelBuilder.Entity<ReleaseBatchLogo>().HasKey(e => e.ReleaseBatchId);
modelBuilder.Entity<ReleaseBatchLogo>().HasOne(e => e.Batch).WithOne(e => e.Logo).OnDelete(DeleteBehavior.Cascade);
}
示例4: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.HasDefaultSchema("mc");
modelBuilder.Entity<MenuCard>()
.ToTable("MenuCards")
.HasKey(c => c.MenuCardId);
modelBuilder.Entity<MenuCard>()
.Property<int>(c => c.MenuCardId)
.ValueGeneratedOnAdd();
modelBuilder.Entity<MenuCard>()
.Property<string>(c => c.Title)
.HasMaxLength(50);
modelBuilder.Entity<Menu>()
.ToTable("Menus")
.HasKey(m => m.MenuId);
modelBuilder.Entity<Menu>()
.Property<int>(m => m.MenuId)
.ValueGeneratedOnAdd();
modelBuilder.Entity<Menu>()
.Property<string>(m => m.Text)
.HasMaxLength(120);
modelBuilder.Entity<Menu>()
.Property<decimal>(m => m.Price)
.HasColumnType("Money");
modelBuilder.Entity<MenuCard>()
.HasMany(c => c.Menus)
.WithOne(m => m.MenuCard);
modelBuilder.Entity<Menu>()
.HasOne(m => m.MenuCard)
.WithMany(c => c.Menus)
.HasForeignKey(m => m.MenuCardId);
}
示例5: CreateFromDatabaseModel
protected virtual IModel CreateFromDatabaseModel([NotNull] DatabaseModel databaseModel)
{
Check.NotNull(databaseModel, nameof(databaseModel));
var modelBuilder = new ModelBuilder(new ConventionSet());
_tableNamer = new CSharpUniqueNamer<TableModel>(t => t.Name);
_columnNamers = new Dictionary<TableModel, CSharpUniqueNamer<ColumnModel>>();
VisitDatabaseModel(modelBuilder, databaseModel);
if (!string.IsNullOrEmpty(databaseModel.DefaultSchemaName))
{
modelBuilder.HasDefaultSchema(databaseModel.DefaultSchemaName);
}
if (!string.IsNullOrEmpty(databaseModel.DatabaseName))
{
modelBuilder.Model.Relational().DatabaseName = databaseModel.DatabaseName;
}
return modelBuilder.Model;
}
示例6: OnModelCreating
protected override void OnModelCreating(ModelBuilder builder)
{
builder.HasDefaultSchema("mab");
base.OnModelCreating(builder);
}
示例7: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasDefaultSchema("blogging");
}
示例8: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasDefaultSchema("public");
modelBuilder.Entity<Position>()
.HasKey(p => p.Id);
}