首页 新闻 会员 周边

关于entity framework 集合类型

0
悬赏园豆:20 [已关闭问题] 关闭于 2012-03-08 10:35

我在项目里面使用ef想对数据库操作在design.cs里面得到类

public partial class EventSetupRecordDataContext : System.Data.Linq.DataContext

有一个属性如下

public System.Data.Linq.Table<EventSetupRecord> EventSetupRecords
        {
            get
            {
                return this.GetTable<EventSetupRecord>();
            }
        }

 

我自己新建了一个项目里面 使用ef,design.cs的context类如下

public partial class dlinqEntities1 : ObjectContext
    {
        #region Constructors
    
        /// <summary>
        /// Initializes a new dlinqEntities1 object using the connection string found in the 'dlinqEntities1' section of the application configuration file.
        /// </summary>
        public dlinqEntities1() : base("name=dlinqEntities1", "dlinqEntities1")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    然后会有一个返回一张表的属性entitytable

  public ObjectSet<entitytable> entitytable
        {
            get
            {
                if ((_entitytable == null))
                {
                    _entitytable = base.CreateObjectSet<entitytable>("entitytable");
                }
                return _entitytable;
            }
        }
        private ObjectSet<entitytable> _entitytable;

是什么造成这种不同的?还有属性返回的类型,还有类的父类有什么差异?

周念中的主页 周念中 | 初学一级 | 园豆:5
提问于:2012-03-08 10:10
< >
分享
所有回答(1)
0

是.net3.5更多 的靠近 linq to sql 后面是.net4.0 做了改进

周念中 | 园豆:5 (初学一级) | 2012-03-08 10:35
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册