简体   繁体   English

如何使用Sqlite设置Entity Framework Core 2.1? -将数据库连接到我的解决方案

[英]How do I setup Entity Framework Core 2.1 with Sqlite? - Connecting Database to My Solution

I am not an expert on this technology yet, so I guess for most this is a very basic question... But I don't really know how to use DBContext and how can I really connect my database, to the cross-platform solution file... and which nuget packages should I use?... where do I reference it?... what classes should I make and what codes do I put in it?... These questions, that I don't even know how to apply on my solution, I hope it doesn't bother you guys... 我还不是该技术的专家,所以我想大多数情况下这是一个非常基本的问题……但是我真的不知道如何使用DBContext,以及如何真正将数据库连接到跨平台解决方案。文件...我应该使用哪个nuget包?...我在哪里引用它?...我应该制作什么类以及应在其中添加什么代码?...这些我什至没有的问题知道如何应用我的解决方案,希望它不会打扰你们...

My goal is to make a datagrid using xaml grid, binded with sqlite database using entity framework core 2.1... 我的目标是使用xaml网格制作一个数据网格,并使用实体框架核心2.1与sqlite数据库绑定...

If you can answer my question in a step-by-step guide that would be really helpful for me... 如果您可以按照分步指南回答我的问题,那对我真的很有帮助...

*How can I setup the Entity Framework Core 2.1 using the database that I created from sqlite? *如何使用从sqlite创建的数据库设置Entity Framework Core 2.1?

    * My Database Location & Name: C:\sqlite\demo.db
    * My Target Framework: .Net Standard 2.0
    * My Visual Studio Version: 15.7.2
    * For Android, IOS, & UWP

You can use the dotnet command line tool: 您可以使用dotnet命令行工具:

dotnet ef dbcontext scaffold "Data Source=demo.db;" Microsoft.EntityFrameworkCore.Sqlite -OutputDir DataFolder -c "context name"

https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db

暂无
暂无

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

相关问题 使用 Entity Framework Core 数据库优先方法如何将我的实体与基础设施层分开? - With Entity Framework Core database first approach how do I separate my entity from infrastructure layer? 如何使用 Entity Framework .NET Core 将数据插入到我的数据库中? - How do I insert data into my database using Entity Framework .NET Core? 如何忽略 Entity Framework Core SQLite 数据库中的外键约束? - How to ignore Foreign Key Constraints in Entity Framework Core SQLite database? 如何使用 Entity Framework Core 在加密的 SQLite 数据库上运行迁移? - How can I run a migration with Entity Framework Core on an encrypted SQLite database? 如何在Entity Framework Core中设置实体关系 - How to setup entity relations in Entity Framework Core Entity Framework Core 2.1中的ReverseEngineeringGenerator - ReverseEngineeringGenerator in Entity Framework Core 2.1 如何使用Entity Framework Core功能更改数据库? - How can I use the Entity Framework Core capabilities to change my database? 我如何获得选项<T>来自 Entity Framework Core 数据库调用? - How do I get an Option<T> from an Entity Framework Core database call? 如何在 Entity Framework Core 数据库更新期间解析类型的服务? - How do I resolve the service for a type during an Entity Framework Core database update? 如何使用 Entity Framework Core 2.1 定义多字段索引 - How to define a multi-field index with Entity Framework Core 2.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM