/// <summary> /// Converts the dto to entities. /// </summary> /// <param name="_AddressDto">The Address dto</param> /// <param name="efAddress">已存在的Address EF model</param> /// <returns>Address</returns> public Address ConvertDtoToEntities(AddressDto _AddressDto, Address efAddress) { if (_AddressDto==null && efAddress==null) { throw new ArgumentNullException("models should not be null"); } ConvertObject(_AddressDto, efAddress); return efAddress; }
/// <summary> /// Converts the dto to entities. /// </summary> /// <param name="_ AddressDto">The Address dto.</param> /// <param name="ef Address">已存的EntityFramework实体 ef Address</param> /// <param name="skipNullPropertyValue">if set to <c>true</c> [skip null property value].</param> /// <returns>Address</returns> public Address ConvertDtoToEntities(AddressDto _AddressDto, Address efAddress, bool skipNullPropertyValue) { if (_AddressDto==null && efAddress==null) { throw new ArgumentNullException("models should not be null"); } ConvertObjectWithCheckNull(_AddressDto, skipNullPropertyValue, efAddress); return efAddress; }
private static void ConvertObjectWithCheckNull(AddressDto _AddressDto, bool skipNullPropertyValue, Address efAddress) { efAddress.AddressID=_AddressDto.AddressID; if (!skipNullPropertyValue || _AddressDto.AddressLine1 != null) {efAddress.AddressLine1=_AddressDto.AddressLine1; } if (!skipNullPropertyValue || _AddressDto.AddressLine2 != null) {efAddress.AddressLine2=_AddressDto.AddressLine2; } if (!skipNullPropertyValue || _AddressDto.City != null) {efAddress.City=_AddressDto.City; } efAddress.StateProvinceID=_AddressDto.StateProvinceID; if (!skipNullPropertyValue || _AddressDto.PostalCode != null) {efAddress.PostalCode=_AddressDto.PostalCode; } efAddress.rowguid=_AddressDto.rowguid; efAddress.ModifiedDate=_AddressDto.ModifiedDate; }
public AddressDto ConvertEntitiesToDto(Address _Address) { return new AddressDto(); }
public Address ConvertDtoToEntities(AddressDto _AddressDto, Address efAddress) { return new Address(); }
public Address ConvertDtoToEntities(AddressDto _AddressDto, Address efAddress, bool skipNullPropertyValue) { return new Address(); }
/// <summary> /// Converts the entities to dto. /// </summary> /// <param name="_Address">The Address entity</param> /// <returns>AddressDto</returns> public AddressDto ConvertEntitiesToDto(Address _Address) { if (_Address==null) { throw new ArgumentNullException("models should not be null"); } var _AddressDto =new AddressDto(); _AddressDto.AddressID=_Address.AddressID; _AddressDto.AddressLine1=_Address.AddressLine1; _AddressDto.AddressLine2=_Address.AddressLine2; _AddressDto.City=_Address.City; _AddressDto.StateProvinceID=_Address.StateProvinceID; _AddressDto.PostalCode=_Address.PostalCode; _AddressDto.rowguid=_Address.rowguid; _AddressDto.ModifiedDate=_Address.ModifiedDate; return _AddressDto; }
private static void ConvertObject(AddressDto _AddressDto, Address efAddress) { efAddress.AddressID=_AddressDto.AddressID; efAddress.AddressLine1=_AddressDto.AddressLine1; efAddress.AddressLine2=_AddressDto.AddressLine2; efAddress.City=_AddressDto.City; efAddress.StateProvinceID=_AddressDto.StateProvinceID; efAddress.PostalCode=_AddressDto.PostalCode; efAddress.rowguid=_AddressDto.rowguid; efAddress.ModifiedDate=_AddressDto.ModifiedDate; }
public void TestAddressRepositoryDelete(Address _Address) { var _AddressRepository = RepositoryHelper.GetAddressRepository(); _AddressRepository.Repository.Delete(_Address); _AddressRepository.Save(); }
public void TestAddressRepositoryAdd(Address _Address) { var _AddressRepository = RepositoryHelper.GetAddressRepository(); _AddressRepository.Add(_Address); _AddressRepository.Save(); }
/// <summary> /// Deletes the specified entity. /// </summary> /// <param name="entity">The entity.</param> public void Delete(Address entity) { Repository.Delete(entity); }
/// <summary> /// Attaches the specified entity. /// </summary> /// <param name="entity">The entity.</param> public void Attach(Address entity) { Repository.Attach(entity); }
/// <summary> /// Adds the specified entity. /// </summary> /// <param name="entity">The entity.</param> public void Add(Address entity) { Repository.Add(entity); }