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
 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. 3
0
        /// <summary>Geterates settings object.</summary>
        public Settings CreateSettings()
        {
            var entitySettingsToRegister =
                from pair in scanTasks
                let assembly = pair.Key
                               let descriptors = pair.Value
                                                 from type in assembly.GetTypes()
                                                 where globalEntityPredicate(type)
                                                 from descriptor in descriptors
                                                 where descriptor.Predicate(type)
                                                 let configSettings = descriptor.EntityConfigSettings
                                                                      where configSettings != null
                                                                      group configSettings by type;

            foreach (var configSettingsGroup in entitySettingsToRegister)
            {
                var configSettingsList = configSettingsGroup.Reverse().ToArray();
                var configSettings     = new EntityConfigSettings();
                foreach (var setting in configSettingsList)
                {
                    configSettings.Merge(setting);
                }
                var entityConfig = configSettings.Create(configSettingsGroup.Key);
                if (entityConfig != null)
                {
                    settings.Register(entityConfig);
                }
            }

            if (settings.Incomplete)
            {
                throw new ConfigurationException("You shoud provide database name and server URL before creating settings.");
            }

            return(settings);
        }
Esempio n. 4
0
 public ScanDescriptor(Predicate<Type> predicate, EntityConfigSettings entityConfigSettings)
 {
     Predicate = predicate;
     EntityConfigSettings = entityConfigSettings;
 }
Esempio n. 5
0
 public ScanDescriptor(Predicate <Type> predicate, EntityConfigSettings entityConfigSettings)
 {
     Predicate            = predicate;
     EntityConfigSettings = entityConfigSettings;
 }