如何修复此车库事件Db = New Garageentities(); [英] How Do I Fix This Garageentities Db = New Garageentities();

查看:57
本文介绍了如何修复此车库事件Db = New Garageentities();的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我如何解决这个问题,它一直出现在以下所有型号中:



购物车型号

产品型号

产品型号型号



每个型号下一个线条总是用红色波浪线加下划线

GarageEntities db = new GarageEntities();



i我是新手。



感谢tom clarke。

解决方案

为什么你甚至在模型类中使用DbContext?



答案很简单。不。

how do i fix this problem it keeps coming up in all the following models:

cart model
product model
product type model

in each of the models the next line is always underlined in red wavey line
GarageEntities db = new GarageEntities();

i am new to this.

thanks tom clarke.

解决方案

Why are you even using the DbContext in your model classes?

The answer is simple. Don't.


这篇关于如何修复此车库事件Db = New Garageentities();的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆