本文整理汇总了C#中FactMemento类的典型用法代码示例。如果您正苦于以下问题:C# FactMemento类的具体用法?C# FactMemento怎么用?C# FactMemento使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FactMemento类属于命名空间,在下文中一共展示了FactMemento类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRoom
protected static FactMemento CreateRoom(long domainId)
{
FactMemento room = new FactMemento(TypeRoom);
room.Data = new byte[] { 1, 2, 3, 4 };
room.AddPredecessor(RoleRoomDomain, new FactID { key = domainId }, true);
return room;
}
示例2: FindExistingFact
public FactID? FindExistingFact(string domain, FactMemento fact)
{
using (var procedures = new Procedures(new Session(_connectionString)))
{
FactID id;
if (FindExistingFact(fact, out id, procedures, readCommitted: true))
return id;
return null;
}
}
示例3: FindExistingFact
public FactID? FindExistingFact(string domain, FactMemento memento)
{
lock (this)
{
// See if the fact already exists.
FactRecord fact = _factTable.FirstOrDefault(o =>
o.IdentifiedFactMemento.Memento.Equals(memento));
if (fact == null)
return null;
else
return fact.IdentifiedFactMemento.Id;
}
}
示例4: CreateFact
public CorrespondenceFact CreateFact(FactMemento memento)
{
Identity newFact = new Identity(memento);
// Create a memory stream from the memento data.
using (MemoryStream data = new MemoryStream(memento.Data))
{
using (BinaryReader output = new BinaryReader(data))
{
newFact._anonymousId = (string)_fieldSerializerByType[typeof(string)].ReadData(output);
}
}
return newFact;
}
示例5: ContactInformation
// Hydration constructor
private ContactInformation(FactMemento memento)
{
InitializeResults();
_order = new PredecessorObj<Order>(this, RoleOrder, memento);
_prior = new PredecessorList<ContactInformation>(this, RolePrior, memento);
}
示例6: Company
// Hydration constructor
private Company(FactMemento memento)
{
InitializeResults();
}
示例7: Closed
// Hydration constructor
private Closed(FactMemento memento)
{
InitializeResults();
_delivered = new PredecessorObj<Delivered>(this, RoleDelivered, memento);
}
示例8: Pull
// Hydration constructor
private Pull(FactMemento memento)
{
InitializeResults();
_order = new PredecessorObj<Order>(this, RoleOrder, memento);
_kitchen = new PredecessorObj<Kitchen>(this, RoleKitchen, memento);
}
示例9: ProvisionFrontOffice
// Hydration constructor
private ProvisionFrontOffice(FactMemento memento)
{
InitializeResults();
_machine = new PredecessorObj<Machine>(this, RoleMachine, memento);
_company = new PredecessorObj<Company>(this, RoleCompany, memento);
}
示例10: CakeDetail
// Hydration constructor
private CakeDetail(FactMemento memento)
{
InitializeResults();
_order = new PredecessorObj<Order>(this, RoleOrder, memento);
_size = new PredecessorObj<CakeSize>(this, RoleSize, memento);
_cakeFlavor = new PredecessorObj<CakeFlavor>(this, RoleCakeFlavor, memento);
_frostingFlavor = new PredecessorObj<FrostingFlavor>(this, RoleFrostingFlavor, memento);
_mainColor = new PredecessorObj<FrostingColor>(this, RoleMainColor, memento);
_decorationColor = new PredecessorObj<FrostingColor>(this, RoleDecorationColor, memento);
_prior = new PredecessorList<CakeDetail>(this, RolePrior, memento);
}
示例11: EnableToastNotification
// Hydration constructor
private EnableToastNotification(FactMemento memento)
{
InitializeResults();
_individual = new PredecessorObj<Individual>(this, RoleIndividual, memento);
}
示例12: CreateFact
public CorrespondenceFact CreateFact(FactMemento memento)
{
Domain newFact = new Domain(memento);
// Create a memory stream from the memento data.
using (MemoryStream data = new MemoryStream(memento.Data))
{
using (BinaryReader output = new BinaryReader(data))
{
}
}
return newFact;
}
示例13: Domain
// Hydration constructor
private Domain(FactMemento memento)
{
InitializeResults();
}
示例14: DisableToastNotification
// Hydration constructor
private DisableToastNotification(FactMemento memento)
{
InitializeResults();
_enable = new PredecessorList<EnableToastNotification>(this, RoleEnable, memento);
}
示例15: Save
public FactID Save(string domain, FactMemento fact, Guid clientGuid)
{
FactID factId;
List<FactID> affectedPivots;
lock (this)
{
// See if the fact already exists.
FactRecord existingFact = _factTable.FirstOrDefault(o =>
o.IdentifiedFactMemento.Memento.Equals(fact));
if (existingFact == null)
{
// It doesn't, so create it.
FactID newFactID = new FactID() { key = _factTable.Count + 1 };
factId = newFactID;
existingFact = new FactRecord()
{
IdentifiedFactMemento = new IdentifiedFactMemento(factId, fact)
};
_factTable.Add(existingFact);
// Store a message for each pivot.
var pivots = fact.Predecessors
.Where(predecessor => predecessor.IsPivot);
_messageTable.AddRange(pivots
.Select(predecessor => new MessageRecord(
new MessageMemento(predecessor.ID, newFactID),
newFactID,
predecessor.Role,
clientGuid)));
// Store messages for each non-pivot. This fact belongs to all predecessors' pivots.
List<FactID> nonPivots = fact.Predecessors
.Where(predecessor => !predecessor.IsPivot)
.Select(predecessor => predecessor.ID)
.ToList();
List<MessageRecord> predecessorsPivots = _messageTable
.Where(message => nonPivots.Contains(message.Message.FactId))
.Distinct()
.ToList();
_messageTable.AddRange(predecessorsPivots
.Select(predecessorPivot => new MessageRecord(
new MessageMemento(predecessorPivot.Message.PivotId, newFactID),
predecessorPivot.AncestorFact,
predecessorPivot.AncestorRole,
clientGuid)));
affectedPivots =
pivots
.Select(pivot => pivot.ID)
.Union(predecessorsPivots
.Select(predecessorPivot => predecessorPivot.Message.PivotId))
.ToList();
}
else
{
factId = existingFact.IdentifiedFactMemento.Id;
affectedPivots = null;
}
}
if (affectedPivots != null && affectedPivots.Any() && PivotAffected != null)
foreach (var pivotId in affectedPivots)
PivotAffected(domain, pivotId, factId, clientGuid);
return factId;
}