使用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.
原文:
最满意答案
您可以尝试使用
DisplayMetrics
来实现您的解决方案int mWidth= this.getResources().getDisplayMetrics().widthPixels; int mHeight= this.getResources().getDisplayMetrics().heightPixels;
You can try with
DisplayMetrics
to achieve your solutionint 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 ...
-
从MapKit(Swift 2)获取中心坐标并显示在UILabel中(Get center coordinates from MapKit and display in UILabel)[2022-06-18]
用其他声明在类的顶部声明var center = "" 。 在下面的方法中,它应该自动改变center的值: func mapView(mapView: MKMapView, regionDidChangeAnimated animated: Bool) { center = mapView.centerCoordinate } 当您按下按钮时,将标签的值设置为中心值。 self.yourLabelName.text = center 要显示为“纬度:...经度:...”,请执行以下操作: fu ... -
风景模式UIView.center给出了Potrait模式坐标(Landscape mode UIView.center gives Portrait mode coordinates)[2023-06-21]
使用边界,而不是框架。 框架位于超视图的坐标系中,对于您的根视图而言,该坐标系是窗口 - 这不会以不同的方向旋转。 界限在视图自己的坐标系中,因此在设置子视图的中心时使用适当的矩形,因为中心也在超视图的坐标系中表示。 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中查看,您还可以以米为单位查看模型的大小(我只是简单地将其视为您可以参考的点来检查计算): 在我的例子中,我使用 ...
-
采取所有屏幕坐标(Take all screen coordinates)[2023-01-09]
那么你可以轻松地使用左上角和右下角的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 ...