/// <summary>
        /// Возвращает адаптер объектов системы.
        /// </summary>
        /// <typeparam name="TObject">Тип объекта системы.</typeparam>
        /// <typeparam name="TEntity">Тип сохраняемого объекта.</typeparam>
        /// <typeparam name="IObject">Тип интерфейса объекта.</typeparam>
        private SkyObjectAdapter <TObject, TEntity, IObject> GetObjectAdapter <TObject, TEntity, IObject>()
            where TEntity : SkyEntity
            where TObject : SkyObject <TObject, TEntity, IObject>, IObject
            where IObject : ISkyObject
        {
            SkyObjectAdapter <TObject, TEntity, IObject> adapter = null;
            Type   type    = typeof(TObject);
            string typeKey = type.AssemblyQualifiedName;

            if (!this.ObjectAdaptersByType.ContainsKey(typeKey))
            {
                adapter = new SkyObjectAdapter <TObject, TEntity, IObject>(this.Context);
                this.ObjectAdaptersByType.Add(typeKey, adapter);
            }
            else
            {
                adapter = (SkyObjectAdapter <TObject, TEntity, IObject>) this.ObjectAdaptersByType[typeKey];
            }

            if (adapter == null)
            {
                throw new Exception(string.Format("Не удалось получить адаптера объектов системы SkyObjectAdapter по ключу {0}.", typeKey));
            }

            return(adapter);
        }
Example #2
0
        internal SkyObject(TEntity entity, SkyObjectAdapter <TObject, TEntity, IObject> adapter)
        {
            if (adapter == null)
            {
                throw new ArgumentNullException("adapter");
            }
            if (entity == null)
            {
                entity = adapter.CreateEntity();
            }

            this.Entity  = entity;
            this.Adapter = adapter;
        }
Example #3
0
 internal SkyNetwork(SkyNetworkEntity entity, SkyObjectAdapter <SkyNetwork, SkyNetworkEntity, ISkyNetwork> adapter)
     : base(entity, adapter)
 {
 }
Example #4
0
 internal SkyTrainEpochParams(SkyTrainEpochParamsEntity entity, SkyObjectAdapter <SkyTrainEpochParams, SkyTrainEpochParamsEntity, ISkyTrainEpochParams> adapter)
     : base(entity, adapter)
 {
 }
Example #5
0
 internal SkyNetworkVersion(SkyNetworkVersionEntity entity, SkyObjectAdapter <SkyNetworkVersion, SkyNetworkVersionEntity, ISkyNetworkVersion> adapter)
     : base(entity, adapter)
 {
 }
Example #6
0
 internal SkyDataSet(SkyDataSetEntity entity, SkyObjectAdapter <SkyDataSet, SkyDataSetEntity, ISkyDataSet> adapter)
     : base(entity, adapter)
 {
 }
Example #7
0
 internal SkyNetworkRequest(SkyNetworkRequestEntity entity, SkyObjectAdapter <SkyNetworkRequest, SkyNetworkRequestEntity, ISkyNetworkRequest> adapter)
     : base(entity, adapter)
 {
 }
Example #8
0
 internal SkyTrainScheme(SkyTrainSchemeEntity entity, SkyObjectAdapter <SkyTrainScheme, SkyTrainSchemeEntity, ISkyTrainScheme> adapter)
     : base(entity, adapter)
 {
 }
Example #9
0
 internal SkyNetworkState(SkyNetworkStateEntity entity, SkyObjectAdapter <SkyNetworkState, SkyNetworkStateEntity, ISkyNetworkState> adapter)
     : base(entity, adapter)
 {
 }
Example #10
0
 internal SkyProfile(SkyProfileEntity entity, SkyObjectAdapter <SkyProfile, SkyProfileEntity, ISkyProfile> adapter)
     : base(entity, adapter)
 {
 }