/// <summary> /// Gets the <see cref="DemoValue"/> data transfer value with the given identifier and filtered by the given parameters. /// </summary> /// <param name="identifier">The data transfer value identifier.</param> /// <param name="queryExpression">The <see cref="ODataExpression"/> containing filter and order parameters.</param> /// <returns>The <see cref="DemoValue"/> data transfer value.</returns> //public override DemoValue Get(Guid identifier, ODataExpression queryExpression = null) public override DemoValue Get(Guid identifier) { DataTransfer.DemoValue value = UnitOfWork.Execute <DataTransfer.DemoValue>(() => { //SecurityToken identity = ApplicationModel.Current.Session.Identity; IDemoApplicationAgent agent = DependencyInjection.Get <IDemoApplicationAgent>(); Domain.Entity.DemoValue entity = agent.GetDemoValue(identifier); DataTransfer.DemoValue _value = entity.ToDataTransferValue(); return(_value); }); return(value); }
public static Domain.Entity.DemoValue Merge(Domain.Entity.DemoValue entity, dynamic data) { Func <ExpandoObject> _data = () => data; // Project the properties. entity .Project(x => x.ID, _data) .Project(x => x.Code, _data) .Project(x => x.Description, _data) .Project(x => x.Value, _data) .Project(x => x.CreationTimestamp, _data, () => DateTime.Parse(data.CreationTimestamp)) .Project(x => x.ValidFrom, _data, () => DateTime.Parse(data.ValidFrom)) .Project(x => x.ValidUntil, _data, () => DateTime.Parse(data.ValidUntil)) ; return(entity); }
public static DataTransfer.DemoValue ToDataTransferValue(this Domain.Entity.DemoValue entity, params PropertyDirective[] directives) { DataTransfer.DemoValue value = new DataTransfer.DemoValue { ID = entity.ID, Code = entity.Code, Description = entity.Description, Value = entity.Value, CreationTimestamp = entity.CreationTimestamp, ValidFrom = entity.ValidFrom, ValidUntil = entity.ValidUntil, __references = entity.__references, __extensions = entity.__extensions }; return(value); }
public static Domain.Entity.DemoValue ToEntity(this DataTransfer.DemoValue value) { Domain.Entity.DemoValue entity = null; if (!value.IsDefault()) { entity = new Domain.Entity.DemoValue { ID = value.ID, Code = value.Code, Description = value.Description, Value = value.Value, CreationTimestamp = value.CreationTimestamp, ValidFrom = value.ValidFrom, ValidUntil = value.ValidUntil, __references = value.__references, __extensions = value.__extensions }; } return entity; }
public static Domain.Entity.DemoValue ToEntity(this DataTransfer.DemoValue value) { Domain.Entity.DemoValue entity = null; if (!value.IsDefault()) { entity = new Domain.Entity.DemoValue { ID = value.ID, Code = value.Code, Description = value.Description, Value = value.Value, CreationTimestamp = value.CreationTimestamp, ValidFrom = value.ValidFrom, ValidUntil = value.ValidUntil, __references = value.__references, __extensions = value.__extensions }; } return(entity); }