简体   繁体   English

这是ASP.NET Web应用程序和wpf桌面应用程序访问同一数据库的有效方法吗?

[英]Is this a valid way for ASP.NET web app and wpf desktop app to access the same database?

.NET framework newbie here! .NET框架新手在这里! If I require an ASP.NET web app and a wpf desktop app to share a database, would it be achievable simply by using the same connection string in both projects? 如果我需要一个ASP.NET Web应用程序和一个wpf桌面应用程序共享一个数据库,是否只需在两个项目中使用相同的连接字符串就可以实现? I am hosting the website locally. 我在本地托管网站。 Or is this an over simplification? 还是这过于简单?

I understand I could develop an API and host it as a web service and then let that do all the heavy lifting for me. 我知道我可以开发一个API并将其作为Web服务托管,然后让它为我完成所有繁重的工作。 But if everything is hosted locally and all I'm doing is having a little fun with these technologies then this is not absolutely necessary, correct? 但是,如果所有内容都在本地托管,而我正在做的就是对这些技术有所了解,那不是绝对必要的,对吗?

There's nothing preventing you from using the same database for multiple applications, just make sure your update, insert or delete commands do not cause a deadlock or data corruptions. 没有什么可以阻止您将同一数据库用于多个应用程序,只需确保您的更新,插入或删除命令不会导致死锁或数据损坏。 This can be achieved in several ways, such as locking a database object before updating or deleting it. 这可以通过多种方式来实现,例如在更新或删除数据库对象之前将其锁定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过asp.net Web应用程序和WPF桌面应用程序访问相同的数据库 - How to access same database by both asp.net web application and WPF desktop application 如何验证ASP.NET Web应用程序以访问SQL数据库 - How to authenticate an asp.net web app to access sql database System.Data.OleDb.OleDbException:无效的密码。 在MS Access数据库ASP.NET/C# Web应用程序中 - System.Data.OleDb.OleDbException: Not a valid password. in MS Access database ASP.NET/C# Web app 具有ASP.NET MVC的数据库Web应用 - Database web app with ASP.NET MVC ASP.NET Web应用程序尝试使用root以外的用户访问MySQL数据库时抛出异常 - ASP.NET web app throwing exception when trying to access MySQL database with user other than root ASP.NET Core 2.1,C#应用程序,C#Web服务,访问SQL数据库 - asp.net core 2.1, C# app, c# web service, access SQL database 带有 Javascript 的 ASP.NET Web 应用程序 - 正确填充数据库列 - ASP.NET web app with Javascript - properly populate database columns ASP.NET 内核 Web API 应用内多数据库 - ASP.NET Core Web API multi database in app 如何在 ASP.NET Web 应用程序中热交换重建的数据库 - How to hot swap rebuilt database in an ASP.NET web app 通过ASP.Net 4基本Web应用程序学习我的方式 - Learning my way thru ASP.Net 4 basic web app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM