This question is locked. New answers and comments are not allowed.
Hi,
There is a table Tb. And there is a view Vw that just extends data from Tb (shows all columns from Tb plus some more). I can create an independent persistent class form this view (manually :-(; there is no support for reverse mapping of views...) and it works. But because they are independent classes, each time I modify the structure of Tb I must modify both classes; for the same reason I cannot cast Vw class to Tb class; and so on.
I would like to have Vw class inheriting from Tb:
class Vw: Tb
but I don't know how to set their configuration in app.config.
For example, let it be:
Table Tb, columns: id, A, B (all ints)
View Vw, columns: id, A, B (directly from Tb), C (from somewhere) - all ints
Classes:
How would the appropriate app.config fragment look like?
And the other question is: is it possible to create such a configuration and make code generator to create both classes (reverse mapping but not: DB -> config -> C# code but only: config -> C# code)
Regards
Tomasz
There is a table Tb. And there is a view Vw that just extends data from Tb (shows all columns from Tb plus some more). I can create an independent persistent class form this view (manually :-(; there is no support for reverse mapping of views...) and it works. But because they are independent classes, each time I modify the structure of Tb I must modify both classes; for the same reason I cannot cast Vw class to Tb class; and so on.
I would like to have Vw class inheriting from Tb:
class Vw: Tb
but I don't know how to set their configuration in app.config.
For example, let it be:
Table Tb, columns: id, A, B (all ints)
View Vw, columns: id, A, B (directly from Tb), C (from somewhere) - all ints
Classes:
[Telerik.OpenAccess.Persistent()] |
public class Tb |
{ |
private int id; |
private int a; |
private int b; |
public Tb() |
{} |
[Telerik.OpenAccess.FieldAlias("id")] |
public int Id |
{ |
get { return id; } |
set { this.id = value; } |
} |
[Telerik.OpenAccess.FieldAlias("a")] |
public int A |
{ |
get { return a; } |
set { this.a = value; } |
} |
[Telerik.OpenAccess.FieldAlias("b")] |
public int B |
{ |
get { return b; } |
set { this.b = value; } |
} |
} |
public class Vw : Tb |
{ |
private int c; |
public Vw() |
: Tb() |
{ } |
[Telerik.OpenAccess.FieldAlias("c")] |
public int C |
{ |
get { return c; } |
set { this.c = value; } |
} |
} |
And the other question is: is it possible to create such a configuration and make code generator to create both classes (reverse mapping but not: DB -> config -> C# code but only: config -> C# code)
Regards
Tomasz