本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}