How to specify the Database Name (LINQtoSQL)

Source: Internet
Author: User
Barefoot learning describes how to generate external XML ing files, DBML files, and verify these two files, this includes the previous demo about how to serialize object class objects in the object model, which is a question about how to create an object model. However, in these demos, we focus on how to use them.

Barefoot learning describes how to generate external XML ing files, DBML files, and verify these two files, this includes the previous demo about how to serialize object class objects in the object model, which is a question about how to create an object model. However, in these demos, we focus on how to use them.

Barefoot Learning

In the previous demonstration, whether it is about how to generate an external XML ing file, a DBML file, and the verification of the two files, including the previous Demonstration about how to make the object model

Object class objects in can be serialized, which is a question of how to create an object model. However, in these demos, the focus of our work is on how to use tools to create

Image model, whether using SQLMetal or object link designer. In the following demos, we will look at how to use the code editor to customize

Object Model ......

You can use the Name Attribute of the DatabaseAttribute to specify the database Name when no Name is provided for the connection.
You can apply the DatabaseAttribute feature to any strongly-typed DataContext declaration.
This information is used only when no database name is specified for the connection.
The DatabaseAttribute feature is optional. If you use this feature, you must use the Name attribute to provide a Name. If this feature is not applied and the connection name is not specified, it is assumed that the database has the same name as the DataContext class.

Sample Code

[Database (Name = "Northwind")] public partial class NorthwindDataContext: System. Data. Linq. DataContext {}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.