DbSet table name

后端 未结 6 1202
广开言路
广开言路 2020-12-03 17:14

To get database table name on Entity framework 4.0 I do:

ObjectSetInstance.EntitySet.ToString()

Is there a way to do this on Entity Framewo

6条回答
  •  误落风尘
    2020-12-03 18:12

    Source: https://msdn.microsoft.com/en-gb/data/jj819164.aspx

    using System.Data.Entity;
    using System.Data.Entity.Infrastructure.DependencyResolution;
    using System.Data.Entity.Infrastructure.Pluralization;
    
    var service = DbConfiguration.DependencyResolver.GetService();
    var entitySetName = service.Pluralize(typeof(TEntity).Name));
    

提交回复
热议问题