Пример #1
0
        public IEntityConfig Create(Type entityType)
        {
            if (CustomEntityConfigFactory != null)
            {
                var customEntityConfig = CustomEntityConfigFactory(entityType);
                if (customEntityConfig != null)
                {
                    return(customEntityConfig);
                }
            }

            PropertyOrPubilcFieldSpecialMember idMember;

            if (IDMemberInfoLookup != null)
            {
                var idMemberInfo = IDMemberInfoLookup(entityType);
                if (idMemberInfo == null)
                {
                    throw new ConfigurationException("ID member lookup convention returned null for {0}", entityType);
                }
                idMember = new PropertyOrPubilcFieldSpecialMember(entityType, idMemberInfo);
            }
            else
            {
                idMember = null;
            }

            var revisionMemberInfo = RevisionMemberInfoLookup == null? null: RevisionMemberInfoLookup(entityType);
            var revisionMember     = revisionMemberInfo == null ? null : new PropertyOrPubilcFieldSpecialMember(entityType, revisionMemberInfo);

            return(new EntityConfig(entityType, EntityTypeToDocumentType, idMember, revisionMember, DocumentIdToEntityId, EntityIdToDocumentId));
        }
Пример #2
0
        public IEntityConfig Create(Type entityType)
        {
            if(CustomEntityConfigFactory != null)
            {
                var customEntityConfig = CustomEntityConfigFactory(entityType);
                if (customEntityConfig != null)
                    return customEntityConfig;
            }

            PropertyOrPubilcFieldSpecialMember idMember;
            if (IDMemberInfoLookup != null)
            {
                var idMemberInfo = IDMemberInfoLookup(entityType);
                if (idMemberInfo == null)
                    throw new ConfigurationException("ID member lookup convention returned null for {0}", entityType);
                idMember = new PropertyOrPubilcFieldSpecialMember(entityType, idMemberInfo);
            }
            else
                idMember = null;

            var revisionMemberInfo = RevisionMemberInfoLookup == null? null: RevisionMemberInfoLookup(entityType);
            var revisionMember = revisionMemberInfo == null ? null : new PropertyOrPubilcFieldSpecialMember(entityType, revisionMemberInfo);

            return new EntityConfig(entityType, EntityTypeToDocumentType, idMember, revisionMember, DocumentIdToEntityId, EntityIdToDocumentId);
        }