c# - Convert from to string in database to boolean property Entity Framework 4.1 -
c# - Convert from to string in database to boolean property Entity Framework 4.1 -
i working on legacy oracle database uses character literals t , f in database boolean values entity property reflect proper boolen value there wy convert value when model binding read database inserts not of import
i suggest wrapping or extending generating type add together sort of functionality ...
entity framework generate objects match info in database tables looks if have table called "contacts" you'll object called "contacts", think (although wrong) classes defined partial generates ...
public partial class contact { string boolreally { get; set; }; } you add together new property ...
public partial class contact { bool mybool { homecoming (legacyvalue == "t") ? true : false; } } now when declare contact instance fish value "mybool" instead.
...
that's extending, wrapping ...
public class mycontact { public contact contact; public bool mybool { { homecoming contact.boolasstring; } } } similar thing ... need consume object differently :)
c# .net entity-framework asp.net-mvc-3 entity-framework-4.1
Comments
Post a Comment