In .NET 3.5sp1,
I have a table in Sql Server that is defined somehow like this:
CREATE TABLE Employee(
EmployeeId [int] IDENTITY(1,1) NOT NULL,
UserName varchar(128) NOT NULL,
[Name] nvarchar(200) NOT NULL,
Address xml NULL,
...)
I am mapping this table to the ADO.NET Entity Framework. My problem is that the xml column is mapped to a string data type. While this is an expected behavior, I'd like to provide my own custom type.
I tried creating a class
public class Address : IXmlSerializable { ... }
and tried replacing the string
data type of the address column to my own Address
type, but I can't find a way to make the entity framework understand my custom type.
I read about complex type, but it says that the value itself cannot be null, and in my case it can be null.
Is it possible and how?