![]() SQL Server 2016 and Azure SQL Database (I will call them SQL Database in the following sections) enables you to store hybrid data with both relational tables and columns, but also you can store some properties as complex structures formatted as JSON text. However, let's assume that you don’t want a separate table for every non-trivial property, so you don’t want to create additional BlogsTags, Tags, and Person tables for these properties. Usually, you need to map them to separate tables because you cannot store string array in the table column. Now imagine that you want to add in the Blog class some complex properties such as tags (array of strings), or information about the blog owner (separate class). Both classes are persisted in database as Blogs and Posts tables. Imagine that you have Blog class in your model that has few value-type properties such as BlogId ( int), Url of the blog ( string), and relationship to the Post class. However, what can we do with the complex properties in the model classes, such as arrays and object? If you have properties in the model classes with simple/value types (e.g., int, double, string, boolean), every value type can be easily mapped into columns of the underlying table. Usually, there is one-to-one relationship between model classes and relational tables. Entity Framework enables you to map your C# model classes to SQL relational tables.
0 Comments
Leave a Reply. |