Created
July 19, 2012 22:05
-
-
Save danielwertheim/3147197 to your computer and use it in GitHub Desktop.
SisoDb - Inheritance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var db = "data source=.;initial catalog=fff;integrated security=true;".CreateSql2012Db(); | |
| db.CreateIfNotExists(); | |
| var p = new Foo2 { Name = "Adam", Points = 1 }; | |
| db.UseOnceTo().Insert<Foo>(p); | |
| } | |
| } | |
| public class Foo | |
| { | |
| public Guid StructureId { get; set; } | |
| public string Name { get; set; } | |
| } | |
| public class Foo2 : Foo | |
| { | |
| public int Points { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use fff; | |
| //We see on the naming that Foo has been used as contract, otherwise it should have been Foo2 | |
| select * from dbo.FooIntegers; | |
| select * from dbo.FooStrings; | |
| select Json from dbo.FooStructure; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RowId StructureId MemberPath | |
| -------------------- ------------------------------------ ------------------ | |
| (0 row(s) affected) | |
| RowId StructureId MemberPath | |
| -------------------- ------------------------------------ ------------------ | |
| 1 689AB380-EDD1-E111-9AB3-5404A6F3A57D Name | |
| (1 row(s) affected) | |
| Json | |
| ---------------------------------------------------------------------------- | |
| {"Points":1,"StructureId":"689ab380edd1e1119ab35404a6f3a57d","Name":"Adam"} | |
| (1 row(s) affected) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment