Example #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;
     }
 }
Example #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);
        }
Example #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);
        }
Example #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;
 }
Example #5
0
 /// <summary>Sets entity type to document type convention.</summary>
 public TSelf WhenDocumentType(EntityTypeToDocumentTypeConvention entityTypeToDocumentType)
 {
     this.entityTypeToDocumentType = entityTypeToDocumentType;
     return((TSelf)this);
 }