Monday, 15 February 2010

ServiceStack OrmLite Class Hierarchy in One table -



ServiceStack OrmLite Class Hierarchy in One table -

i have base of operations abstract class , 2 derived classes , want of them stored in 1 table(table per hierarchy); how can accomplish in servicestack ormlite or workaround issue.

public abstract class mybaseclass { public string name { get; set; } } public class myderivedclassa : mybaseclass { public string name1 { get; set; } } public class myderivedclassb : mybaseclass { public string name2 { get; set; } }

ormlite poco's map 1:1 underlying table properties need flattened in base of operations class. if want can utilize [alias] have types @ same table, i.e:

[alias("table")] public abstract class mybaseclass { public string name { get; set; } public string name1 { get; set; } public string name2 { get; set; } } [alias("table")] public class myderivedclassa : mybaseclass {} [alias("table")] public class myderivedclassb : mybaseclass {}

but rather pointless. map types appear in database, it's makes much easier reason what's happening.

ormlite-servicestack

No comments:

Post a Comment