Friday, August 6, 2010

Entity Framework (CTP4)

Playing with the new Entity Framework I had a need to store files.


Simply add Byte[] to your CLR

public class Product
{
public int ProductId { get; set; }
[StringLength(40)]
public string Name { get; set; }
public Byte[] ProductImage { get; set; } //Maps to VARBINARY(MAX)
public string CategoryId { get; set; }

public virtual Category Category { get; set; }
}

Automapper

Just found Automapper which takes the boring part out of mapping by doing it automatically