///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Explicit initialization. Must be called on creating new project.
        /// </summary>
        public void PostInit(CapacitiesInfo capacitiesInfo,
                             OrderCustomPropertiesInfo orderCustomPropertiesInfo)
        {
            Debug.Assert(!_isInited); // init once

            // add scheme objects
            DataModel.ConfigSchemes scheme = DataModel.ConfigSchemes.CreateConfigSchemes(SCHEME_ID_CAPACITIES);
            scheme.Name  = SCHEME_NAME_CAPACITIES;
            scheme.Value = ConfigDataSerializer.SerializeCapacitiesInfo(capacitiesInfo);
            AddObject(SCHEMES_ENTITY_SET, scheme);

            scheme       = DataModel.ConfigSchemes.CreateConfigSchemes(SCHEME_ID_ORDERPROPERTIES);
            scheme.Name  = SCHEME_NAME_ORDERPROPERTIES;
            scheme.Value = ConfigDataSerializer.SerializeOrderCustomPropertiesInfo(orderCustomPropertiesInfo);
            AddObject(SCHEMES_ENTITY_SET, scheme);

            base.SaveChanges();

            // create object factory
            ObjectInitData initData = new ObjectInitData();

            initData.CapacitiesInfo            = capacitiesInfo;
            initData.OrderCustomPropertiesInfo = orderCustomPropertiesInfo;

            _fact        = new DataObjectFactory(initData);
            _objInitData = initData;

            // Attach handler for SavingChanges event.
            this.SavingChanges += new EventHandler(DataObjectContext_SavingChanges);
            _isInited           = true;
        }
        /// <summary>
        /// Updates order custom properties info in database.
        /// </summary>
        /// <param name="propertiesInfo">Order custom properrties info.</param>
        public void UpdateCustomOrderPropertiesInfo(OrderCustomPropertiesInfo propertiesInfo)
        {
            Debug.Assert(propertiesInfo != null);

            // Get custom order properties config scheme.
            DataModel.ConfigSchemes customOrderPropertiesScheme = _GetConfigSchemeObject(SCHEME_ID_ORDERPROPERTIES);

            // Update value of custom order properties database field.
            customOrderPropertiesScheme.Value =
                ConfigDataSerializer.SerializeOrderCustomPropertiesInfo(propertiesInfo);

            // Update init data.
            _objInitData.OrderCustomPropertiesInfo = propertiesInfo;

            // Save changes to the database.
            base.SaveChanges();
        }