I have a column Price
in one of my SQL Server tables:
Price decimal(20, 2)
In model generated by Entity Framework, it looks like this:
public Nullable<decimal> Price { get; set; }
When retrieving the record, I get only 3 instead of 3.15! What could be the issue?
Entity_Product eProduct = new Entity_Product();
var pr = new DataModel.Entity_Product();
pr = Init.ProductRepository.GetById(ProductId);
eProduct.Name = pr.Name;
eProduct.CommercialName = pr.CommercialName;
eProduct.PackageType = pr.PackageType;
eProduct.DrugType = pr.DrugType;
eProduct.DrugCode = pr.DrugCode;
eProduct.ProductId = pr.ProductId;
eProduct.Administration = pr.Administration;
eProduct.Manufacturer = pr.Manufacturer;
eProduct.Price = pr.Price;
eProduct.Strength = pr.Strength;
eProduct.StregnthUnit = pr.StregnthUnit;
eProduct.Barcode = pr.Barcode;
eProduct.IsEnabled = pr.IsEnabled;
eProduct.CreatedOn = pr.CreatedOn;
eProduct.CreatedBy = pr.CreatedBy;
eProduct.UpdatedOn = pr.UpdatedOn;
eProduct.UpdatedBy = pr.UpdatedBy;
return eProduct;
public T GetById(params object[] idies)
{
return ContextProvider.Set<T>().Find(idies);
}