c# - ServiceStack not using custom converter for NodaTime.Instant -


in effort improve performance, added denormalized sql views our database , created query models correlate. working great except 1 thing -- servicestack ormlite isn't using custom type converter of query model fields , can't figure out why. what's confusing is using converter model correlates actual table.

i've confirmed field names correlate columns being returned database. i've confirmed sql query ormlite constructing includes fields in question. i've confirmed data being returned sql valid. reason ormlite never hits fromdbvalue method in converter.

here's simplified version of i'm doing:

write model

public class session {     [autoincrement]     public int id { get; set; }     public instant sessiontime { get; set; } // <-- populated      // -- other fields --      [references(typeof(user))]     public int userid { get; set; }     [reference]     public user user { get; set; } } 

query model

public class sessionquerymodel {     public int id { get; set; }     public instant sessiontime { get; set; } // <-- not populated      // -- other fields --      public int userid { get; set; }     public string userfirstname { get; set; }     public string userlastname { get; set; } } 

the write model correlates table named session. query model correlates view called sessionquerymodel has user table joined in , retrieves name fields.

my instant data stored in datetime2 field, , register custom converter properly. if wrong there, write model wouldn't hydrated.

i can't life of me figure out what's going on. can't see difference between two, field names match up, etc. thing can figure ormlite reason can't glean type view in same way can table. ideas might causing this?

update
appears it's not instant fields. there handful of other fields aren't being populated well, though they're in data names matching properties in query model poco. there doesn't seem rhyme or reason. of these simple varchar columns mapping string properties.

now i'm confused.

i figured out. class in question had 2 enum properties. 1 of type sessionstates , other sessionstatuses. guess didn't pay attention intellisense entry originally, , similar names made not easy see.

anyway, enum values stored in sql strings, not integers, , when servicestack mapping, can assume inability parse string enum value caused mapping cease.

demis, if you're out there, looks it's bug. think system should throw error if there parsing error opposed stopping mapping.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -