Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Linq to SQL framework to select relevant data entities

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "how to use the Linq to SQL framework to select related data entities", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the Linq to SQL framework to select related data entities" this article.

1. Use Linq to SQL framework to select related data entities and call relevant stored procedures in the configure behavior dialog box. It is very convenient to use stored procedures to update data.

Solution: ① implements the data access layer by adding data authentication and data access methods.

② uses the data access layer through Linq

③ sets insert and update properties in the properties window of the data entity class, respectively.

④ implements insert and update stored procedures in the configure behavior dialog box.

1.1 add data validation rules:

Public partial class PlayerInfoVO {partial void OnNameChanging (string value) {Regex myName = new Regex (@ "^ [a-zA-Z0-9 _] {3pm 16} $"); if (myName.IsMatch (value) = = false) {throw new ArgumentException ("invalid name");}

1.2 create a data access method

Public partial class MYDBDataContext {public myLevel GetMyLevel (int id) {return this.myLevel.Single (c = > c.id = = id);}}

Note that this code is to be written in dbml

1.3 use the data access layer

1.4 increase data

1, write a Proc named InsertPlayer, set @ OK to output type and in to input type

two,

Pop-up configuration behavior

The above is all the contents of the article "how to select relevant data entities using the Linq to SQL framework". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report