繁体   English   中英

具有POCO连接的LINQPad隐藏实体

[英]LINQPad Hiding Entities with POCO Connection

当我使用POCO连接将LINQPad连接到我的自定义程序集时,我缺少了一些实体。 这是一个移交给我的项目,所以我不确定是什么原因造成的。

这是我在LINQPad中看到的FooContext,

FooContext

这是我的项目模型

模型

该表未显示在LINQPad中,

[Table("People")]
public class Person : DomainEntity
{
    [Required, StringLength(50)]
    public String GivenName { get; set; }

    [Required, StringLength(50)]
    public String Surname { get; set; }

    public virtual ICollection<EmailAddress> EmailAddresses { get; set; }

    public virtual ICollection<Phone> Phones { get; set; }

    public virtual ICollection<PhysicalAddress> PhysicalAddresses { get; set; }

    public virtual ICollection<Login> Logins { get; set; }

    public virtual ICollection<CompanyContact> CompanyContacts { get; set; }
}

这是一张桌子,

[Table("Tags")]
public class Tag
{
    public int Id { get; set; }
    public String Value { get; set; }
    public virtual DomainEntity Entity { get; set; }
}

是什么决定LINQPad为FooContext显示什么?

LINQPad使用以下逻辑来确定要在模式浏览器中显示的实体:

System.Data.Entity.Infrastructure.IObjectContextAdapter adapter = this;
var items = adapter.ObjectContext.MetadataWorkspace.GetItems (DataSpace.CSpace);
var container = (EntityContainer) items.First (i => i.BuiltInTypeKind == BuiltInTypeKind.EntityContainer);
var entities = container.BaseEntitySets.Where (b => b.BuiltInTypeKind == BuiltInTypeKind.EntitySet && b.ElementType != null && b.ElementType is EntityType);
entities.Dump(1);

当您在LINQPad中运行此代码并选择了自定义POCO数据上下文时,是否会显示表?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM