Exemple #1
0
        internal PObject(IStorage repository, int id, Dictionary<int, IPObject> objectsIndex, bool deferredLoad)
        {
            if (repository == null)
                throw new Exception("Хранилище данных не задано");

            Id = id;
            _ownerCollection = null;

            this.storage = repository;
            this.objectsIndex = objectsIndex;
            this._deferredLoad = deferredLoad;

            // получение значений атрибутов
            _attrs = repository.ListAttributes(Id);

            if (objectsIndex != null)
                objectsIndex.Add(id, this);

            // загрузка коллекций
            _collections = new Dictionary<string, PCollection>();

            List<string> collectsNames = storage.ListCollections(Id);
            foreach (string name in collectsNames)
            {
                string lowName = name.ToLower();
                _collections.Add(lowName, new PCollection(this, lowName, deferredLoad));
            }
        }