简体   繁体   English

.net Core中的SharpRepository EfCoreRepository初始化

[英]SharpRepository EfCoreRepository Initialization in .net Core

I need help in initializing SharpRepository in .net Core? 在.net Core中初始化SharpRepository时需要帮助吗? How do I use dbcontext with SharpRepository? 如何在SharpRepository中使用dbcontext? Where in startup can I put initialization code? 在启动时可以在哪里放置初始化代码?

I am using Entityframeworkcore with sql server 我在SQL Server中使用Entityframeworkcore

https://github.com/SharpRepository/SharpRepository https://github.com/SharpRepository/SharpRepository

Please post if you have sample code 如果您有示例代码,请发表

Thank you 谢谢

now EfCore repository is stable! 现在,EfCore存储库很稳定!

You need to setup DbContext at the same way microsoft suggest 您需要以Microsoft建议的相同方式设置DbContext

services.AddDbContext<ContactContext>(options =>
                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

in ConfigureServices inside Statup.cs 在Statup.cs内的ConfigureServices中

you can find a setup guide https://github.com/SharpRepository/SharpRepository/wiki/Getting-started 您可以找到安装指南https://github.com/SharpRepository/SharpRepository/wiki/入门

a full .net core mvc project sample is here: https://github.com/SharpRepository/SharpRepository/tree/develop/SharpRepository.Samples.CoreMvc 完整的.net核心mvc项目示例在这里: https : //github.com/SharpRepository/SharpRepository/tree/develop/SharpRepository.Samples.CoreMvc

Regards 问候

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

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