Esempio n. 1
0
        protected MdbArea(MdbDataStore store, IConfigSectionNode node) : base(store)
        {
            if (store == null || node == null || !node.Exists)
            {
                throw new MdbException(StringConsts.ARGUMENT_ERROR + "MdbArea.ctor(store==null|node==null|!Exists)");
            }


            ConfigAttribute.Apply(this, node);

            var dsnode = node[CommonApplicationLogic.CONFIG_DATA_STORE_SECTION];

            if (!dsnode.Exists)
            {
                throw new MdbException(StringConsts.MDB_AREA_CONFIG_NO_DATASTORE_ERROR.Args(node.RootPath));
            }

            m_PhysicalDataStore = FactoryUtils.MakeAndConfigure <ICRUDDataStoreImplementation>(dsnode, args: new [] { this });
        }
Esempio n. 2
0
        internal MdbPartitionedArea(MdbDataStore store, IConfigSectionNode node) : base(store, node)
        {
            m_Name = node.AttrByName(Configuration.CONFIG_NAME_ATTR).ValueAsString(string.Empty).Trim();

            if (m_Name.IsNullOrWhiteSpace())
            {
                throw new MdbException(StringConsts.MDB_AREA_CONFIG_NO_NAME_ERROR);
            }

            if (m_Name.EqualsOrdIgnoreCase(CENTRAL_AREA_NAME))
            {
                throw new MdbException(StringConsts.MDB_AREA_CONFIG_INVALID_NAME_ERROR + "MDBPartitionedArea can not be called '{0}'".Args(CENTRAL_AREA_NAME));
            }

            m_Partitions = new List <Partition>();
            foreach (var pnode in node.Children.Where(cn => cn.IsSameName(CONFIG_PARTITION_SECTION)))
            {
                var partition = new Partition(this, pnode);
                m_Partitions.Add(partition);
            }

            if (m_Partitions.Count == 0)
            {
                throw new MdbException(StringConsts.MDB_AREA_CONFIG_NO_PARTITIONS_ERROR.Args(Name));
            }

            if (m_Partitions.Count != m_Partitions.Distinct().Count())
            {
                throw new MdbException(StringConsts.MDB_AREA_CONFIG_DUPLICATE_RANGES_ERROR.Args(Name));
            }

            m_Partitions.Sort();// sort by StartGDID

            for (var i = 0; i < m_Partitions.Count; i++)
            {
                m_Partitions[i].__setOrder(i);
            }
        }
Esempio n. 3
0
 internal MDBCentralArea(MdbDataStore store, IConfigSectionNode node) : base(store, node)
 {
     m_CentralPartition = new Partition(this, node);
 }