public virtual void UpdateKeyFields(IObjectDto sourceDto) { if (sourceDto is ProductVersionChangeDto) { var _sourceDto = (ProductVersionChangeDto)sourceDto; this.Id = _sourceDto.Id; } }
public virtual void UpdateKeyFields(IObjectDto sourceDto) { if (sourceDto is EntityBaseDto) { var _sourceDto = (EntityBaseDto)sourceDto; this.Id = _sourceDto.Id; } }
public override void UpdateKeyFields(IObjectDto sourceDto) { base.UpdateKeyFields(sourceDto); if (sourceDto is CarDto) { var _sourceDto = (CarDto)sourceDto; this.SuperKey = _sourceDto.SuperKey; this.Owner = (PersonDto)DtoUtils.Clone(_sourceDto.Owner); } }
public void UpdateKeyFields(IObjectDto sourceDto) { if (sourceDto is AddressDto) { var _sourceDto = (AddressDto)sourceDto; this.SByteField = _sourceDto.SByteField; this.Int16Field = _sourceDto.Int16Field; this.Int32Field = _sourceDto.Int32Field; this.Int64Field = _sourceDto.Int64Field; this.ByteField = _sourceDto.ByteField; this.UInt16Field = _sourceDto.UInt16Field; this.UInt32Field = _sourceDto.UInt32Field; this.UInt64Field = _sourceDto.UInt64Field; this.DateTimeField = _sourceDto.DateTimeField; this.GuidField = _sourceDto.GuidField; this.ByteArrayField = _sourceDto.ByteArrayField; this.StringField = _sourceDto.StringField; this.ExtraKey = _sourceDto.ExtraKey; } }
public static TResultEntity ReplayToEntity <TSourceDto, TResultEntity>(this TSourceDto modifiedDto, IObjectDto originalDto, Session session) where TResultEntity : class, IEntity where TSourceDto : IObjectDto { TResultEntity result = default(TResultEntity); var originalList = new List <object>(); if (originalDto != null) { originalList.Add(originalDto); } var modifiedList = new List <object> { modifiedDto }; Mapper mapper = CreateMapper(session); ReadOnlyDictionary <object, object> keyMapping; using (var compareResult = mapper.Compare(originalList, modifiedList)) { compareResult.Operations.Replay(); keyMapping = compareResult.KeyMapping; } Dictionary <Key, IObjectDto> dtoObjectMappings; List <Key> entityKeys = RetrieveEntityKeys(modifiedList, keyMapping, true, out dtoObjectMappings); if (entityKeys.Count == 1 && modifiedList.Count == entityKeys.Count) { Key entityKey = entityKeys[0]; result = Query.SingleOrDefault <TResultEntity>(entityKey); if (result != null) { modifiedDto.UpdateKeyFields(result.TransformToDto <TSourceDto>(session)); } } return(result); }
private static void SetDtoKey(IObjectDto dto, string key) { dto._MappingKey = key; }
private static string GetDtoKey(IObjectDto dto) { return(dto._MappingKey); }