本文整理汇总了C#中ModelBuilder.Ignore方法的典型用法代码示例。如果您正苦于以下问题:C# ModelBuilder.Ignore方法的具体用法?C# ModelBuilder.Ignore怎么用?C# ModelBuilder.Ignore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelBuilder
的用法示例。
在下文中一共展示了ModelBuilder.Ignore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Entity>()
.HasKey(e => e.ID)
.ForSqliteHasName("ID");
modelBuilder.Entity<Settings>()
.HasKey(e => e.ID)
.ForSqliteHasName("ID");
modelBuilder.Ignore<Entity>();
}
示例2: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
//Ignores
modelBuilder.Ignore<DataPoint>();
modelBuilder.Ignore<MarketsAndNews>();
modelBuilder.Ignore<MarketQuotes>();
modelBuilder.Ignore<OperationStatus>();
modelBuilder.Ignore<TickerQuote>();
modelBuilder.Ignore<Security>();
// Map these class names to the table names in the DB for Table Per Type (TPT)
// Currently not supported in EF7
//modelBuilder.Entity<Security>().ToTable("Security");
//modelBuilder.Entity<Stock>().ToTable("Stock");
//modelBuilder.Entity<MutualFund>().ToTable("MutualFund");
//Create one to many relationship between Customer/BrokerageAccounts
//modelBuilder.Entity<Customer>()
// .Collection(c => c.BrokerageAccounts)
// .InverseReference(ba => ba.Customer)
// .ForeignKey(ba => ba.CustomerId);
//modelBuilder.Entity<BrokerageAccount>()
// .Collection(ba => ba.Positions)
// .InverseReference(p => p.BrokerageAccount)
// .ForeignKey(p => p.BrokerageAccountId);
}
示例3: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Ignore<Currency>();
modelBuilder.Ignore<CurrencyPair>();
}
示例4: OnModelCreating
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Ignore<BlogMetadata>();
}