當前位置: 首頁>>代碼示例>>C#>>正文


C# Entity.SetValue方法代碼示例

本文整理匯總了C#中System.Entity.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# Entity.SetValue方法的具體用法?C# Entity.SetValue怎麽用?C# Entity.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Entity的用法示例。


在下文中一共展示了Entity.SetValue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PopulateDefaults

 private void PopulateDefaults(Entity e, Command c)
 {
     e.SetValue(SyncUtils.CLIENTID, c.ClientId);
     e.SetValue(SyncUtils.PROCESSED, DateTime.Now);
     e.SetValue(SyncUtils.NUMBER, order++);
     e.SetValue(SyncUtils.TRANSACTION, transactionId);
 }
開發者ID:npenin,項目名稱:uss,代碼行數:7,代碼來源:SyncCommandProcessor.cs

示例2: InitializeInfo

        /// <summary>
        /// Initializes information about the last transaction number
        /// </summary>
        /// <param name="engine"></param>
        private void InitializeInfo(IPersistenceEngine engine)
        {
            Entity e = new Entity(SyncUtils.INFO);
            e.SetValue(SyncUtils.TRANSACTION, 0);
            e.SetValue(SyncUtils.CLIENTID, String.Empty);

            Transaction t = new Transaction(engine.Factory.Model);
            t.Serialize(e);
            t.Commit(engine, false);
        }
開發者ID:npenin,項目名稱:uss,代碼行數:14,代碼來源:SyncEngine.cs

示例3: Visit

        public override DeleteEntityCommand Visit(DeleteEntityCommand c)
        {
            Entity e = new Entity(SyncUtils.DELETE_ENTITY);
            PopulateDefaults(e, c);

            e.SetValue(SyncUtils.PARENTID, c.ParentId);
            e.SetValue(SyncUtils.TYPE, c.Type);

            transaction.Serialize(e);

            return c;
        }
開發者ID:npenin,項目名稱:uss,代碼行數:12,代碼來源:SyncCommandProcessor.cs

示例4: BeginInitializeInfo

        private void BeginInitializeInfo(AsyncCallback callback, IPersistenceEngineAsync engine)
        {
            Entity e = new Entity(SyncUtils.INFO);
            e.SetValue(SyncUtils.TRANSACTION, 0);
            e.SetValue(SyncUtils.CLIENTID, String.Empty);

            Transaction t = new Transaction(engine.FactoryAsync.Model);
            t.Serialize(e);
            t.BeginCommit(callback, engine, false, t);
        }
開發者ID:npenin,項目名稱:uss,代碼行數:10,代碼來源:SyncEngine.cs

示例5: FullDownload


//.........這裏部分代碼省略.........
            {
                t = new Transaction(client.Factory.Model);
            }

            position = 0;

            // Import all relationships
            foreach (Model.Entity entity in client.Factory.Model.Entities.Values)
            {
                if (Progressed != null)
                {
                    ProgressEventArgs args = new ProgressEventArgs(queries.Count + position++, "Processing " + entity.Type + " relationships", queries.Count + client.Factory.Model.Entities.Count);
                    Progressed(this, args);

                    if (args.Cancel)
                    {
                        return;
                    }
                }

                // Process only root types as it will load all children
                if (entity.Inherit != String.Empty && entity.Inherit != null)
                    continue;

                foreach (Entity parent in client.Load(entity.Type))
                {
                    foreach (Model.Reference reference in server.Factory.Model.GetInheritedReferences(parent.Type))
                    {
                        string uniqueParentKey = String.Concat(entity.Type, ".", parent.Id);
                        string reversedParentId = reverseTable.Contains(uniqueParentKey) ? reverseTable[uniqueParentKey].ToString() : parent.Id;

                        string query = String.Concat(entity.Type, "[id('", reversedParentId, "')].", reference.Name);
                        int count = Convert.ToInt32(server.LoadScalar(String.Concat("count(", query, ")")));

                        // Loads a set of entities (span)
                        if (count > 0)
                        {
                            if (!bulk)
                            {
                                t = new Transaction(client.Factory.Model);
                            }

                            IList<Entity> entities = server.Load(query);

                            foreach (Entity e in entities)
                            {
                                string uniqueChildKey = String.Concat(e.Type, ".", e.Id);
                                string childId = translationTable.Contains(uniqueChildKey) ? translationTable[uniqueChildKey].ToString() : e.Id;

                                t.PushCommand(new Commands.CreateReferenceCommand(reference, parent, e));
                            }

                            if (!bulk)
                            {
                                t.Commit(client, false);
                            }
                        }
                    }
                }
            }

            if (bulk)
            {
                t.Commit(client, false);
            }

            // Creates a Connection token if the providers permit it
            if (client is SyncEngine && server is SyncEngine)
            {
                Entity connection = GetConnection(((SyncEngine)client).ClientId, (SyncEngine)server);

                Transaction it;
                Entity info = null;
                IPersistenceEngine engine = GetPeerMetadataEngine((SyncEngine)server, Peer.Server);
                IList<Entity> infos = engine.Load("from " + SyncUtils.INFO + "i select i");

                if (infos.Count > 0)
                {
                    info = infos[0];
                }
                else
                {
                    info = new Entity(SyncUtils.INFO);
                    info.SetValue(SyncUtils.TRANSACTION, 0);
                    info.SetValue(SyncUtils.CLIENTID, String.Empty);

                    it = new Transaction(engine.Factory.Model);
                    it.Serialize(info);
                    it.Commit(engine, false);
                }

                connection.SetValue(SyncUtils.TRANSACTION, info.GetInt32(SyncUtils.TRANSACTION));

                it = new Transaction(engine.Factory.Model);
                it.Serialize(connection);
                it.Commit(engine, false);

                ((SyncEngine)client).IgnoreClientMetadata = false;
            }
        }
開發者ID:npenin,項目名稱:uss,代碼行數:101,代碼來源:Synchronizer.cs


注:本文中的System.Entity.SetValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。