public InheritancePublicFactsReplicator(IMainStorageContext context, RealStorage publicFactsStorage) : base(context.Logger) { _context = context; _publicFactsStorage = publicFactsStorage.LogicalStorage; _publicInheritanceStorage = publicFactsStorage.InheritanceStorage; _inheritanceResolver = context.DataResolversFactory.GetInheritanceResolver(); _resolverOptions = new ResolverOptions() { AddTopType = false }; }
//private List<RealStorage> _storagesList; public void LoadFromSourceCode() { //_storagesList = new List<RealStorage>(); var globalStorageSettings = new RealStorageSettings(); var parentStoragesList = new List <IStorage>(); switch (_kindGlobalOfStorage) { case KindOfStorage.Global: { var publicFactsStorageSettings = new RealStorageSettings(); publicFactsStorageSettings.MainStorageContext = _context; _publicFactsStorage = new RealStorage(KindOfStorage.PublicFacts, publicFactsStorageSettings); _inheritancePublicFactsReplicator = new InheritancePublicFactsReplicator(_context, _publicFactsStorage); globalStorageSettings.InheritancePublicFactsReplicator = _inheritancePublicFactsReplicator; //_storagesList.Add(_publicFactsStorage); _selfFactsStorage = new RealStorage(KindOfStorage.PublicFacts, publicFactsStorageSettings); parentStoragesList.Add(_selfFactsStorage); var perceptedFactsStorageSettings = new RealStorageSettings(); perceptedFactsStorageSettings.MainStorageContext = _context; _perceptedFactsStorage = new RealStorage(KindOfStorage.PerceptedFacts, perceptedFactsStorageSettings); //_storagesList.Add(_perceptedFactsStorage); parentStoragesList.Add(_perceptedFactsStorage); } break; case KindOfStorage.Host: { var publicFactsStorageSettings = new RealStorageSettings(); publicFactsStorageSettings.MainStorageContext = _context; _publicFactsStorage = new RealStorage(KindOfStorage.PublicFacts, publicFactsStorageSettings); _inheritancePublicFactsReplicator = new InheritancePublicFactsReplicator(_context, _publicFactsStorage); globalStorageSettings.InheritancePublicFactsReplicator = _inheritancePublicFactsReplicator; //_storagesList.Add(_publicFactsStorage); _selfFactsStorage = new RealStorage(KindOfStorage.PublicFacts, publicFactsStorageSettings); parentStoragesList.Add(_selfFactsStorage); } break; } globalStorageSettings.MainStorageContext = _context; if (_parentStorage != null && _parentStorage.Storage != null) { parentStoragesList.Add(_parentStorage.Storage); } if (parentStoragesList.Any()) { globalStorageSettings.ParentsStorages = parentStoragesList; } switch (_kindGlobalOfStorage) { case KindOfStorage.Global: _globalStorage = new GlobalStorage(globalStorageSettings); break; case KindOfStorage.World: _globalStorage = new WorldStorage(globalStorageSettings); break; case KindOfStorage.Host: _globalStorage = new HostStorage(globalStorageSettings); break; default: throw new ArgumentOutOfRangeException(nameof(_kindGlobalOfStorage), _kindGlobalOfStorage, null); } //_storagesList.Add(_globalStorage); _globalStorage.DefaultSettingsOfCodeEntity = CreateDefaultSettingsOfCodeEntity(); #if IMAGINE_WORKING //Log("Do"); #else throw new NotImplementedException(); #endif }