Esempio n. 1
0
 public void Merge(EntityConfigSettings lowerPrioritySettings)
 {
     if (EntityTypeToDocumentType == null)
     {
         EntityTypeToDocumentType = lowerPrioritySettings.EntityTypeToDocumentType;
     }
     if (IDMemberInfoLookup == null)
     {
         IDMemberInfoLookup = lowerPrioritySettings.IDMemberInfoLookup;
     }
     if (RevisionMemberInfoLookup == null)
     {
         RevisionMemberInfoLookup = lowerPrioritySettings.RevisionMemberInfoLookup;
     }
     if (DocumentIdToEntityId == null)
     {
         DocumentIdToEntityId = lowerPrioritySettings.DocumentIdToEntityId;
     }
     if (EntityIdToDocumentId == null)
     {
         EntityIdToDocumentId = lowerPrioritySettings.EntityIdToDocumentId;
     }
     if (CustomEntityConfigFactory == null)
     {
         CustomEntityConfigFactory = lowerPrioritySettings.CustomEntityConfigFactory;
     }
 }
Esempio n. 2
0
        /// <constructor />
        public EntityConfig(
            Type entityType,
            EntityTypeToDocumentTypeConvention entityTypeToDocumentType = null,
            ISpecialMember idMember       = null,
            ISpecialMember revisionMember = null,
            DocumentIdToEntityIdConvention documentIdToEntityId = null,
            EntityIdToDocumentIdConvention entityIdToDocumentId = null)
        {
            if (entityType == null)
            {
                throw new ArgumentNullException("entityType");
            }
            if (!HasDefaultConstructor(entityType))
            {
                throw new ConfigurationException("Entity {0} should have a default constuctor (public or private)", entityType.FullName);
            }


            idMember                 = idMember ?? DefaultEntityConfigConventions.GetIdMember(entityType);
            revisionMember           = revisionMember ?? DefaultEntityConfigConventions.GetRevisionMember(entityType);
            entityTypeToDocumentType = entityTypeToDocumentType ?? DefaultEntityConfigConventions.EntityTypeToDocumentType;
            documentIdToEntityId     = documentIdToEntityId ?? DefaultEntityConfigConventions.DocumentIdToEntityId;
            entityIdToDocumentId     = entityIdToDocumentId ?? DefaultEntityConfigConventions.EntityIdToDocumentId;

            EntityType                = entityType;
            DocumentType              = entityTypeToDocumentType(entityType);
            this.idMember             = idMember;
            this.revisionMember       = revisionMember;
            this.documentIdToEntityId = documentIdToEntityId;
            this.entityIdToDocumentId = entityIdToDocumentId;
            IgnoredMembers            = GetIgnoredMemberInfo(idMember, revisionMember);
        }
Esempio n. 3
0
        /// <constructor />
        public EntityConfig(
            Type entityType,
            EntityTypeToDocumentTypeConvention entityTypeToDocumentType = null,
            ISpecialMember idMember = null,
            ISpecialMember revisionMember = null,
            DocumentIdToEntityIdConvention documentIdToEntityId = null,
            EntityIdToDocumentIdConvention entityIdToDocumentId = null)
        {
            if (entityType == null) throw new ArgumentNullException("entityType");
            if(!HasDefaultConstructor(entityType))
                throw new ConfigurationException("Entity {0} should have a default constuctor (public or private)", entityType.FullName);

            idMember                    = idMember                  ?? DefaultEntityConfigConventions.GetIdMember(entityType);
            revisionMember              = revisionMember            ?? DefaultEntityConfigConventions.GetRevisionMember(entityType);
            entityTypeToDocumentType    = entityTypeToDocumentType  ?? DefaultEntityConfigConventions.EntityTypeToDocumentType;
            documentIdToEntityId        = documentIdToEntityId      ?? DefaultEntityConfigConventions.DocumentIdToEntityId;
            entityIdToDocumentId        = entityIdToDocumentId      ?? DefaultEntityConfigConventions.EntityIdToDocumentId;

            EntityType = entityType;
            DocumentType = entityTypeToDocumentType(entityType);
            this.idMember = idMember;
            this.revisionMember = revisionMember;
            this.documentIdToEntityId = documentIdToEntityId;
            this.entityIdToDocumentId = entityIdToDocumentId;
            IgnoredMembers = GetIgnoredMemberInfo(idMember, revisionMember);
        }
Esempio n. 4
0
 public void Merge(EntityConfigSettings lowerPrioritySettings)
 {
     if (EntityTypeToDocumentType == null)
         EntityTypeToDocumentType = lowerPrioritySettings.EntityTypeToDocumentType;
     if (IDMemberInfoLookup == null)
         IDMemberInfoLookup = lowerPrioritySettings.IDMemberInfoLookup;
     if (RevisionMemberInfoLookup == null)
         RevisionMemberInfoLookup = lowerPrioritySettings.RevisionMemberInfoLookup;
     if (DocumentIdToEntityId == null)
         DocumentIdToEntityId = lowerPrioritySettings.DocumentIdToEntityId;
     if (EntityIdToDocumentId == null)
         EntityIdToDocumentId = lowerPrioritySettings.EntityIdToDocumentId;
     if (CustomEntityConfigFactory == null)
         CustomEntityConfigFactory = lowerPrioritySettings.CustomEntityConfigFactory;
 }
Esempio n. 5
0
 /// <summary>Sets entity type to document type convention.</summary>
 public TSelf TranslatingEntityIdToDocumentIdAs(EntityIdToDocumentIdConvention entityIdToDocumentId)
 {
     this.entityIdToDocumentId = entityIdToDocumentId;
     return((TSelf)this);
 }