My database contains a column of type string, that represents a URL. I'm now wondering how its possible to map this string to a Uri object using the Entity Framework.
Any ideas?
Use a partial class, w/ a custom property:
public partial class MyClass
{
public Uri MyUri
{
get
{ return new Uri(StringUriPropertyFromDB); }
}
}
You can make the string property private in the EF designer, if you want. Note you can't use custom properties like this in LINQ to entities, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With