protected override void OnLoading(SafeWarehouseContext dbContext, Customer entity) { var suppliersValue = (string)dbContext.Entry(entity).Property("SuppliersData").CurrentValue; entity.Suppliers = !string.IsNullOrWhiteSpace(suppliersValue) ? suppliersValue.Split(',') : new List <string>(); }
protected override void OnLoading(SafeWarehouseContext dbContext, Report entity) { var json = (string)dbContext.Entry(entity).Property("LocationsData").CurrentValue; entity.Locations = !string.IsNullOrWhiteSpace(json) ? JsonConvert.DeserializeObject <List <Location> >(json) : new List <Location>(); }
protected override void OnSaving(SafeWarehouseContext dbContext, Customer entity) { dbContext.Entry(entity).Property("SuppliersData").CurrentValue = string.Join(",", entity.Suppliers); }
protected override void OnSaving(SafeWarehouseContext dbContext, Report entity) { var json = JsonConvert.SerializeObject(entity.Locations); dbContext.Entry(entity).Property("LocationsData").CurrentValue = json; }