Some type mappings may result in overflow or data loss exceptions while translating to or from the database. For more information on serialization support, see Binary Serialization. With the exception of serialization, LINQ to SQL does not support mapping between any CLR or SQL Server data types that are not specified in this matrix. The following diagram shows the expected run-time behavior of specific type mappings when data is retrieved from or saved to the database. For more information, see How to: Dynamically Create a Database. The default type mappings for the CreateDatabase method define which type of SQL Server columns are created to map to the CLR types in the object model. You can also use the CreateDatabase method to create a SQL Server database based on the mapping information in the object model or external mapping file. For more information about using these tools, see Creating the Object Model. The default type mappings for these tools define which CLR types are chosen to map to columns inside the SQL Server database. You can create the object model or external mapping file automatically with the Object Relational Designer (O/R Designer) or the SQLMetal command-line tool. This topic discusses the following points:īehavior Differences Between CLR and SQL Execution For more information, see Attribute-Based Mapping and External Mapping. Alternatively, you can specify the mapping information outside the object model with an external mapping file. You can define type mappings and other mapping information, such as database structure and table relationships, inside the object model with attribute-based mapping. LINQ to SQL uses a type mapping to match each common language runtime (CLR) type with a particular SQL Server type. In order to translate data between the object model and the database, a type mapping must be defined. When the database returns the results, LINQ to SQL translates the results back to objects that you can work with in your own programming language. When the application runs, LINQ to SQL translates the language-integrated queries in the object model into SQL and sends them to the database for execution. In LINQ to SQL, the data model of a relational database maps to an object model that is expressed in the programming language of your choice.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |