CTP5实体内部属性 [英] CTP5 Internal Propertieis on Entities

查看:102
本文介绍了CTP5实体内部属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经能够在实体上添加内部属性现在它不允许我

I used to be able to add internal properties on entities now it doesn't let me

配置属性'X'不是实体上的声明属性' Y"。验证它是否未从模型中明确排除,并且它是有效的原始属性。

The configured property 'X' is not a declared property on the entity 'Y'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property.

推荐答案

Kyle,

 

我可以使用CTP5映射内部属性。 
例如,这对我有用:

I am able to map an internal property with CTP5.  For example, this works for me:

 

   
public class
Foo

    public class Foo

   
{

    {

       
public int Id {
获得; set ; }

        public int Id { get; set; }

       
内部 字符串名称{
获得; set ; }

        internal string Name { get; set; }

   
}

    }

 

   
public class
FooContext DbContext

    public class FooContext : DbContext

< span style ="font-family:Consolas; font-size:9.5pt">    
{

    {

       
public DbSet < > Foos {
get ; set ; }

        public DbSet<Foo> Foos { get; set; }

 

   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
受保护 覆盖
void OnModelCreating( ModelBuilder modelBuilder)

        protected override void OnModelCreating(ModelBuilder modelBuilder)

       
{

        {

           
modelBuilder.Entity< Foo >()。属性(f => f.Name);

            modelBuilder.Entity<Foo>().Property(f => f.Name);

    &NBSP;&NBSP;&NBSP;&NBSP;
}

        }

   
}

    }

 

你能否提供一些不适合你的案例的详细信息?

 

谢谢,

Arthur


这篇关于CTP5实体内部属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆