How to map a string to Uri type using the Entity Framework?

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?

Answers


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.


Need Your Help

How to configure classloader for ear in websphere 6.1 (specifically wsdl4j)

java ant websphere

I have a war file (actually not my own, it's Apache ODE 1.2) that fails to deploy into WAS 6.1 because of a classloader issue - and a specific incompatibility with wsdl4j.

Sql Splitting Function

sql string function split

I have a string like that "10*cat*123456;12*rat*789;15*horse*365" i want to split it to be like that "cat, rat, horse" I have made this Function