In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "LINQ TO SQL operation according to example analysis". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
LINQ TO SQL is so good and powerful that it contains almost all the database-related LINQ TO SQL operations we can think of, and even some that we may not have thought of.
In any case, maybe we need to add a custom business logic to the LINQ TO SQL operation, such as logging when an entity is inserted, and so on. How to achieve such a function?
In fact, LINQ TO SQL also took this into account when designing. We can open the designer.cs file of that dtml file, and we find some hidden code
Suppose we need to add some business logic to InsertCustomer, what should we do?
Using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Model {public partial class NorthwindDataContext {partial void InsertCustomer (Customer instance) {/ / you can implement your own save logic here, according to the passed instance of Customer this.ExecuteCommand ("Insert Into."); / / you can also write logs, etc.}
Once we do this, we are entirely responsible for the logic of inserting the Customer. You need to make sure that the code is complete.
Using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Model {public partial class NorthwindDataContext {partial void InsertCustomer (Customer instance) {/ / you can implement your own save logic here, according to an instance of Customer passed in this.ExecuteCommand ("Insert Into.") / / you can also write a log, etc.} this is the end of the content of "LINQ TO SQL operation is analyzed by examples". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.