首页 \ 问答 \ 使用Entity Framework DbContext的类库(Class library using Entity Framework DbContext)

使用Entity Framework DbContext的类库(Class library using Entity Framework DbContext)

我有两个ASP.NET MVC5项目,我想将它们连接到同一个数据库。 我创建了一个包含模型和DbContext

第一个应用程序正确连接,但是当我运行第二个应用程序时,我得到一个错误说:

无法将文件'c:\ users \ saibi \ documents \ visual studio 2015 \ Projects \ MonPFE \ MonPFE.Frontend \ App_Data \ MonPFEContext-20161121115318.mdf'作为数据库'MonPFEContext-20161121115318'附加

PS:我在每个项目中都有web.config


I have two ASP.NET MVC5 projects, I want to connect them to the same database. I created a class library that contains the models and the DbContext.

The first app connects correctly, but when I run the second one I get an error says :

Cannot attach the file 'c:\users\saibi\documents\visual studio 2015\Projects\MonPFE\MonPFE.Frontend\App_Data\MonPFEContext-20161121115318.mdf' as database 'MonPFEContext-20161121115318'

PS: I have web.config in each project.


原文:
更新时间:2022-07-19 15:07

最满意答案

您可以尝试使用DisplayMetrics来实现您的解决方案

int mWidth= this.getResources().getDisplayMetrics().widthPixels;
int mHeight= this.getResources().getDisplayMetrics().heightPixels;

You can try with DisplayMetrics to achieve your solution

int mWidth= this.getResources().getDisplayMetrics().widthPixels;
int mHeight= this.getResources().getDisplayMetrics().heightPixels;

相关问答

更多
  • 这里有一个简单的例子: GeoCoordinateWatcher watcher; watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default) { MovementThreshold = 20 }; watcher.PositionChanged += this.watcher_PositionChanged; wa ...
  • 您可以使用窗口的innerWidth和innerHeight来居中它: const popupWidth = 200; const popupHeight = 100; const popupTop = (window.innerHeight / 2) - (popupHeight / 2); const popupLeft = (window.innerWidth / 2) - (popupWidth / 2); window.open('https://google.com', 'Google Sea ...
  • 用其他声明在类的顶部声明var center = "" 。 在下面的方法中,它应该自动改变center的值: func mapView(mapView: MKMapView, regionDidChangeAnimated animated: Bool) { center = mapView.centerCoordinate } 当您按下按钮时,将标签的值设置为中心值。 self.yourLabelName.text = center 要显示为“纬度:...经度:...”,请执行以下操作: fu ...
  • 使用边界,而不是框架。 框架位于超视图的坐标系中,对于您的根视图而言,该坐标系是窗口 - 这不会以不同的方向旋转。 界限在视图自己的坐标系中,因此在设置子视图的中心时使用适当的矩形,因为中心也在超视图的坐标系中表示。 Use bounds, not frame. Frame is in the superview's coordinate system which for your root view is the window - this does not rotate in different ori ...
  • 每个SCNNode都有一个boundingBox属性,它是: 对象边界框的最小和最大角点。 所以这意味着: 场景套件在局部坐标空间中使用标识其角的两个点定义边界框,这隐含地确定了标记其极限的六个轴对齐的平面。 例如,如果几何的边界框具有最小角{-1,0,2}和最大角{3,4,5},则几何的顶点数据中的所有点都具有介于-1.0和3.0之间的x坐标值, 包括的。 如果您在SceneKit Editor中查看,您还可以以米为单位查看模型的大小(我只是简单地将其视为您可以参考的点来检查计算): 在我的例子中,我使用 ...
  • 那么你可以轻松地使用左上角和右下角的lat / lon坐标 GeoPoint tlGpt; // Top left GeoPoint brGpt; // Bottom right tlGpt = mapView.getProjection().fromPixels(0, 0); brGpt = mapView.getProjection().fromPixels(mapView.getWidth(), mapView.getHeight()); 在您可以在地图上实际看到公交车站的任何缩放级别,左上方的经 ...
  • 每个CCTMXTiledMap都有一个CCTMXLayer,你可以使用方法tile在http://www.cocos2d-iphone.org/api-ref/0.99.5/interface_c_c_t_m_x_layer.html#a91a1765d9698222d8401b523f9064168中传递坐标瓷砖坐标(1,8) )例如,它返回CCSprite。 使用该CCSprite,您可以像获取任何其他CCNode派生对象一样获得其位置。 如果你有任何时髦的分层内容,你可能需要使用 [thatSprit ...
  • 如何为组合框下方的下拉项目的视觉空间做类似的事情? 您可以访问用于显示组合框项目的JList。 JComboBox comboBox = new JComboBox(...); BasicComboPopup popup = (BasicComboPopup)comboBox.getAccessibleContext().getAccessibleChild(0); JList list = popup.getList(); Rectangle bounds = list.getCellBounds(... ...
  • 我猜你正确得到了中心坐标,但是setY正在设置ImageView底边的位置。 在我的头顶,你可以尝试类似的东西 SomeImageView.setY(height - SomeImageView.getDrawable().getIntrinsicHeight()); I guess you're correctly getting the center coordinates, but setY is setting the position of the bottom edge of your Ima ...
  • 您可以尝试使用DisplayMetrics来实现您的解决方案 int mWidth= this.getResources().getDisplayMetrics().widthPixels; int mHeight= this.getResources().getDisplayMetrics().heightPixels; You can try with DisplayMetrics to achieve your solution int mWidth= this.getResources().get ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)