Hi all,
Can you show me, how to implement insert an Entity with Lookup Attribute(s) in a Insert method, for example, Product Entity that has a Category lookup and there is not any insert sample.
public Product InsertProduct(Product product)
{
using (var context = DataContextFactory.CreateContext())
{
context.ProductEntities.InsertOnSubmit(entity);
context.SubmitChanges();
// update business object with new version and id
product.ProductId = entity.ProductId;
product.Version = VersionConverter.ToString(entity.Version);
}
}
public class Product : BusinessObject
{
public Product() { Version = _versionDefault; }
public int ProductId { get; set; }
public string ProductName { get; set; }
public string Weight { get; set; }
public double UnitPrice { get; set; }
public int UnitsInStock { get; set; }
public Category Category { get; set; }
public string Version { get; set; }
}