本文整理汇总了C#中Domain.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Domain.GetType方法的具体用法?C# Domain.GetType怎么用?C# Domain.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoreAsKnownLocation
/// <summary>
/// Stores the location object in the db of known locations
/// </summary>
/// <param name="location">location object to store, required fields should be populated</param>
public void StoreAsKnownLocation(Domain.Location.Location location)
{
//Forces proxy loading
location.GetType();
location.LocationSensorDatas = CurrentLocation.LocationSensorDatas;
_locations.Add(location);
}
示例2: TryLoadFromSnapshot
public bool TryLoadFromSnapshot(Type aggregateRootType, Snapshot snapshot, CommittedEventStream committedEventStream, out Domain.AggregateRoot aggregateRoot)
{
aggregateRoot = null;
if (snapshot == null) return false;
if (AggregateSupportsSnapshot(aggregateRootType, snapshot.Payload.GetType()))
{
try
{
Log.DebugFormat("Reconstructing aggregate root {0}[{1}] from snapshot", aggregateRootType.FullName,
snapshot.EventSourceId.ToString("D"));
aggregateRoot = _aggregateRootCreator.CreateAggregateRoot(aggregateRootType);
aggregateRoot.InitializeFromSnapshot(snapshot);
aggregateRoot.RestoreFromSnapshot(snapshot.Payload);
Log.DebugFormat("Applying remaining historic event to reconstructed aggregate root {0}[{1}]",
aggregateRootType.FullName, snapshot.EventSourceId.ToString("D"));
aggregateRoot.InitializeFromHistory(committedEventStream);
}
catch (Exception ex)
{
Log.ErrorFormat("Cannot load snapshot for '{0}' aggregate. {1}",
aggregateRoot.GetType().FullName, ex.Message);
aggregateRoot = null;
return false;
}
return true;
}
return false;
}
示例3: TryTakeSnapshot
public bool TryTakeSnapshot(Domain.AggregateRoot aggregateRoot, out Snapshot snapshot)
{
snapshot = null;
try
{
var payload = ((dynamic)aggregateRoot).CreateSnapshot();
snapshot = new Snapshot(aggregateRoot.EventSourceId, aggregateRoot.Version, payload);
return true;
}
catch (Exception ex)
{
Log.ErrorFormat("Cannot take snapshot for '{0}' aggregate. {1}",
aggregateRoot.GetType().FullName, ex.Message);
snapshot = null;
return false;
}
}
示例4: GenerateNumber
public string GenerateNumber(Domain.Order.Model.Operation operation)
{
var now = DateTime.UtcNow;
var retVal = operation.GetType().Name.Substring(0, 2).ToUpper() + now.DayOfYear.ToString("000") + now.TimeOfDay.Minutes.ToString("00");
return retVal;
}
示例5: TransformPlanHistory
private PlanHistory TransformPlanHistory(
Domain.FleetPlanBC.Aggregates.AircraftPlanHistoryAgg.PlanHistory dbPlanHistory)
{
if (dbPlanHistory.GetType() != typeof (Domain.FleetPlanBC.Aggregates.AircraftPlanHistoryAgg.OperationPlan))
{
var planHistory = new OperationPlan
{
PlanHistoryID = dbPlanHistory.Id,
PlanAircraftID = dbPlanHistory.PlanAircraftId,
PlanID = dbPlanHistory.PlanId,
ApprovalHistoryID = dbPlanHistory.ApprovalHistoryId,
ActionCategoryID = dbPlanHistory.ActionCategoryId,
TargetCategoryID = dbPlanHistory.TargetCategoryId,
AircraftTypeID = dbPlanHistory.AircraftTypeId,
AirlinesID = dbPlanHistory.AirlinesId,
PerformAnnualID = dbPlanHistory.PerformAnnualId,
CarryingCapacity = dbPlanHistory.CarryingCapacity,
SeatingCapacity = dbPlanHistory.SeatingCapacity,
IsValid = dbPlanHistory.IsValid,
Note = dbPlanHistory.Note,
IsSubmit = dbPlanHistory.IsSubmit,
};
var operationPlan = dbPlanHistory as Domain.FleetPlanBC.Aggregates.AircraftPlanHistoryAgg.OperationPlan;
if (operationPlan != null)
{
planHistory.OperationHistoryID = operationPlan.OperationHistoryId;
}
if (dbPlanHistory.PlanAircraft != null)
{
planHistory.PlanAircraft = TransformPlanAircraft(dbPlanHistory.PlanAircraft);
if (planHistory.PlanAircraft != null && dbPlanHistory.PlanAircraft.Aircraft != null)
{
planHistory.PlanAircraft.Aircraft = TransformAircraft(dbPlanHistory.PlanAircraft.Aircraft);
}
}
return planHistory;
}
if (dbPlanHistory.GetType() != typeof (Domain.FleetPlanBC.Aggregates.AircraftPlanHistoryAgg.ChangePlan))
{
var planHistory = new ChangePlan
{
PlanHistoryID = dbPlanHistory.Id,
PlanAircraftID = dbPlanHistory.PlanAircraftId,
PlanID = dbPlanHistory.PlanId,
ApprovalHistoryID = dbPlanHistory.ApprovalHistoryId,
ActionCategoryID = dbPlanHistory.ActionCategoryId,
TargetCategoryID = dbPlanHistory.TargetCategoryId,
AircraftTypeID = dbPlanHistory.AircraftTypeId,
AirlinesID = dbPlanHistory.AirlinesId,
PerformAnnualID = dbPlanHistory.PerformAnnualId,
CarryingCapacity = dbPlanHistory.CarryingCapacity,
SeatingCapacity = dbPlanHistory.SeatingCapacity,
IsValid = dbPlanHistory.IsValid,
Note = dbPlanHistory.Note,
IsSubmit = dbPlanHistory.IsSubmit,
};
var changePlan = dbPlanHistory as Domain.FleetPlanBC.Aggregates.AircraftPlanHistoryAgg.ChangePlan;
if (changePlan != null)
{
planHistory.AircraftBusinessID = changePlan.AircraftBusinessId;
}
if (dbPlanHistory.PlanAircraft != null)
{
planHistory.PlanAircraft = TransformPlanAircraft(dbPlanHistory.PlanAircraft);
if (planHistory.PlanAircraft != null && dbPlanHistory.PlanAircraft.Aircraft != null)
{
planHistory.PlanAircraft.Aircraft = TransformAircraft(dbPlanHistory.PlanAircraft.Aircraft);
}
}
return planHistory;
}
return null;
}