Exemple #1
0
        //private MetaDataMember itemMember;

        internal DynamicMetaTable(DynamicModel model, MetaTable source)
        {
            this.model  = model;
            this.source = source;

            //itemMember = source.RowType.InheritanceRoot.PersistentDataMembers.FirstOrDefault(DynamicMappingSource.ItemMemberPredicate);
        }
Exemple #2
0
        internal DynamicRootType(DynamicModel model, MetaType source)
            : base(model, source)
        {
            Debug.Assert(source == source.InheritanceRoot);

            this.source = source;
            this.model  = model;
            //indexerDataMember = source.DataMembers.FirstOrDefault(DynamicMappingSource.ItemMemberPredicate);

            ORDINAL_START = source.DataMembers.Count - 1;
        }
Exemple #3
0
        internal DynamicMetaType(DynamicModel model, MetaType source)
        {
            this.source                      = source;
            this.model                       = model;
            this.extendDataMembers           = new Dictionary <string, MetaDataMember>();
            this.extendPersistentDataMembers = new Dictionary <string, MetaDataMember>();

            dataMemberList = new MyList(source.DataMembers, extendDataMembers);
            var mylist2 = new MyList(source.PersistentDataMembers, extendPersistentDataMembers);

            this.dataMembers           = new ReadOnlyCollection <MetaDataMember>(dataMemberList);
            this.persistentDataMembers = new ReadOnlyCollection <MetaDataMember>(mylist2);
            if (model.Source is AttributedMetaModel)
            {
                if (((AttributedMetaModel)model.Source).AttributeProvider is FluentMappingSource.AttributeProvider)
                {
                    var attrProvider =
                        ((FluentMappingSource.AttributeProvider)((AttributedMetaModel)model.Source).AttributeProvider);

                    var entityMapping = attrProvider.Mapping.GetEntityMapping(source.Type);
                    if (entityMapping != null)
                    {
                        foreach (var item in entityMapping.MemberColumnPairs)
                        {
                            if (item.Key is IndexerMemberInfo)
                            {
                                var dataMember = new AttributedMetaDataMember((AttributedMetaType)this.Source, item.Key, dataMembers.Count);
                                extendDataMembers[item.Key.Name]           = dataMember;
                                extendPersistentDataMembers[item.Key.Name] = dataMember;
                            }
                        }
                    }
                }
            }

            this.identities = dataMembers.Where(m => m.IsPrimaryKey).ToList().AsReadOnly();
        }