[英]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.