Exemplo n.º 1
0
        // public void SetExStorageRootToElement(Element e)
        // {
        //  AppRootElement = e;
        // }

        // public void SetExStorageRootToBasePt()
        // {
        //  SetExStorageRootToElement(Util.GetProjectBasepoint());
        // }

        public bool GetRootEntity(ExStoreRoot xRoot, out Entity e, out DataStorage ds)
        {
            Schema schema = GetRootSchema();

            // makeRootSchema(xRoot);

            return(DsMgr.GetDataStorage(schema, out e, out ds));
        }
Exemplo n.º 2
0
        public ExStoreMgr()
        {
            ExStorageTests.location = 100;

            XRoot = ExStoreRoot.Instance();
            XApp  = ExStoreApp.Instance();

            Initialize();
            Configure();
        }
Exemplo n.º 3
0
        public Schema MakeRootSchema(ExStoreRoot xRoot)
        {
            SchemaBuilder sb = new SchemaBuilder(xRoot.ExStoreGuid);

            makeSchemaDef(ref sb, xRoot.Name, xRoot.Description);

            makeSchemaFields(ref sb, xRoot.Data);

            Schema schema = sb.Finish();

            return(schema);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Write the data into the entity per the schema <br/>
        ///
        /// </summary>
        /// <param name="xRoot"></param>
        /// <returns></returns>
        // public ExStoreRtnCodes WriteRootData(ExStoreRoot xRoot, Entity e)
        public ExStoreRtnCodes WriteRootData(ExStoreRoot xRoot, DataStorage ds)
        {
            // SchemaGuidManager.SetUniqueAppGuidSubStr();
            // xRoot.Data[SchemaRootKey.APP_GUID].Value = SchemaGuidManager.AppGuidString;

            Transaction t = null;

            try
            {
                // SchemaBuilder sb = new SchemaBuilder(xRoot.ExStoreGuid);
                //
                // makeSchemaDef(sb, xRoot.Name, xRoot.Description);
                //
                // makeSchemaFields(sb, xRoot.Data);
                //
                // Schema schema = sb.Finish();

                Schema schema = GetRootSchema();
                // makeRootSchema(xRoot);

                Entity e = new Entity(schema);

                writeData(e, e.Schema, xRoot.Data);

                // using (t = new Transaction(AppRibbon.Doc, "Save Cells Default Config Info"))
                // {
                //  t.Start();
                ds.SetEntity(e);
                //  t.Commit();
                // }
            }
            catch (InvalidOperationException ex)
            {
                if (t != null && t.HasStarted())
                {
                    t.RollBack();
                    t.Dispose();
                }

                if (ex.HResult == -2146233088)
                {
                    return(ExStoreRtnCodes.XRC_DUPLICATE);
                }

                return(ExStoreRtnCodes.XRC_FAIL);
            }

            return(ExStoreRtnCodes.XRC_GOOD);
        }
Exemplo n.º 5
0
        public ExStoreRtnCodes ReadRootData(ref ExStoreRoot xRoot)
        {
            Entity e;
            Schema s;

            ExStoreRtnCodes result = getRootSchemaAndEntity(out e, out s);

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(result);
            }

            result = ReadData <SchemaRootKey, SchemaDictionaryRoot, SchemaDictionaryRoot>(e, s, xRoot);

            if (result != ExStoreRtnCodes.XRC_GOOD)
            {
                return(result);
            }

            return(ExStoreRtnCodes.XRC_GOOD);
        }