简体   繁体   English

在c#类库中使用sql数据库

[英]Using sql data base in c# class Library

在此输入图像描述

在此输入图像描述

I have a problem, that I can't reference SQL Server database project in a class library project to manage database (insert, delete and more...). 我有一个问题,我不能在类库项目中引用SQL Server数据库项目来管理数据库(插入,删除等等)。

I want to build "book store system" solution with uwp project, class library project that holds base classes and derives classes, and another class library that holds manager class with functions that manage the system. 我想用uwp项目构建“书店系统”解决方案,包含基类和派生类的类库项目,以及另一个包含管理系统功能的管理器类的类库。

I tried to create new SQL Server database project and succeeded to access a database that I created in SSMS. 我尝试创建新的SQL Server数据库项目,并成功访问我在SSMS中创建的数据库。 But when I tried to reference it from the class library by using Publish command it didn't work. 但是当我尝试使用Publish命令从类库中引用它时,它无效。

I didn't use actually code but I tried to use the buttons 我没有使用实际的代码,但我试图使用按钮

I expected that it will open me the option to call reference 我希望它会打开我调用引用的选项

我认为你可以使用EF代码第一个应用程序或数据库第一个样式,如果你想自己管理数据库并轻松处理映射数据库表的上下文类,你可以在这里找到完整的例子

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM