I have a Linq-To-Sql mapping between POCO classes and my DB. I want to be able to add properties on my classes which represent slightly more complex constructs than simple scalr values.
For instance, I have a custom struct type which holds two simple scalar values. I don't want to make this another table and then add a FK as the property. Is it possible to map this struct's properties using the Linq-to-Sql XML mapping file?
For instance,
public class Foo
{
public string Blah { get; set; }
public Bar Yada { get; set; }
}
public struct Bar
{
public int A { get; set; }
public int B { get; set; }
}
How would I specify that Blah
, Yada.A
, and Yada.B
are all persisted as columns on the Foo
table?
Can this even be done?