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

Map how ADO.NET sets parameters

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "mapping ADO.NET how to set parameters", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "mapping ADO.NET how to set parameters" this article.

There are many problems to pay attention to when setting up ADO.NET, and the first thing you encounter is the configuration of the environment. I didn't use the ADO.NET I learned before. So I spent a week basically practicing. Net 1.0, so the ADO.NET setting delayed me a lot of things.

These three stored procedures need to be mapped to the entity class at the same time, that is, if you map the stored procedure for the insert method of an entity class, then updates and deletes must also map the stored procedure. All three of our stored procedures operate on the User table, so select the UserInfo entity class and set it in the Mapping details tab to map entities to functions.

Select the corresponding stored procedure name where the insert / update / delete function is selected, and then set the mapping of the property. General stored procedure parameters are automatically mapped, but foreign key columns need to be set manually.

Groupid in the Delete stored procedure is a useless parameter. The reason for adding this parameter to ADO.NET is that two entity classes are involved in both insert and update operations. If the navigation attribute Group is not mapped in the delete function, a 2048 error will be reported.

Now, CRUD's stored procedures have been mapped. The ADO.NET setting calls the stored procedure insert / update / delete operation by simply updating the entity class with AddToUserInfos/ and SaveChanges/DeleteObject these methods as usual. The query needs to be called explicitly.

1Entitiesdb=newEntities (); 2UserInfou=db.GetUserInfo (userid). FirstOrDefault (); that's all of the article "Mapping ADO.NET how to set parameters". 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