当我尝试通过 Visual Studio 2012 部署到 Azure 云服务时,出现以下错误:
Windows Azure could not find the resource Diagnostics in the service package. To
upgrade the deployment, you must add the resource. Otherwise, perform a new deployment.
Run Code Online (Sandbox Code Playgroud)
任何想法这意味着什么,或者我如何解决它?
I am attempting to use the geometry functionality in Sql Server and EF Core.
I've installed the following packages
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="2.2.6" />
<PackageReference Include="NetTopologySuite" Version="2.0.0" />
Run Code Online (Sandbox Code Playgroud)
In my Startup.cs, I have the following:
services.AddDbContextPool<CRFlowContext>(options =>
options.UseSqlServer("connection string", x => x.UseNetTopologySuite());
});
Run Code Online (Sandbox Code Playgroud)
Everything builds fine, but when I attempt to run the app, I get the following error:
Application startup exception: System.MissingMethodException: Method not found: 'GeoAPI.IGeometryServices NetTopologySuite.NtsGeometryServices.get_Instance()'.
at Microsoft.Extensions.DependencyInjection.SqlServerNetTopologySuiteServiceCollectionExtensions.AddEntityFrameworkSqlServerNetTopologySuite(IServiceCollection serviceCollection)
at Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerNetTopologySuiteOptionsExtension.ApplyServices(IServiceCollection services)
at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.ApplyServices(IDbContextOptions options, ServiceCollection services)
at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c__DisplayClass4_0.<GetOrAdd>b__2(Int64 …Run Code Online (Sandbox Code Playgroud) 我有一个Customers EF POCO类,其中包含对Address表的引用.
以下代码似乎有效,但我不确定这是最干净的方法.有没有更好的方法只使用一次Map调用来映射它?
[HttpGet]
public ActionResult Details(string ID)
{
BusinessLogic.Customers blCustomers = new BusinessLogic.Customers("CSU");
DataModels.Customer customer = blCustomers.GetCustomer(ID);
CustomerDetailsViewModel model = new CustomerDetailsViewModel();
Mapper.CreateMap<DataModels.Customer, CustomerDetailsViewModel>();
Mapper.CreateMap<DataModels.Address, CustomerDetailsViewModel>();
Mapper.Map(customer, model);
Mapper.Map(customer.Address, model);
return View(model);
}
Run Code Online (Sandbox Code Playgroud) 我只是学习实体框架,并在将其与我的分层代码结构相结合方面取得了一些进展.我有2个可视图层,一个业务层和一个数据访问层.
我的问题是在层之间传递实体对象.此代码示例不起作用:
// BLL
public static void Test1()
{
List<User> users = (from u in GetActiveUsers()
where u.ID == 1
select u).ToList<User>();
// Do something with users
}
// DAL
public static IQueryable<User> GetActiveUsers()
{
using (var context = new CSEntities())
{
return from u in context.Users
where u.Employee.FirstName == "Tom"
select u;
}
}
Run Code Online (Sandbox Code Playgroud)
我收到错误消息ObjectContext实例已被释放,不能再用于需要连接的操作.
如果我从GetActiveUsers方法中删除使用它,它工作正常.
我知道这是危险的做法,因为GC可以在任何给定时间处理上下文并搞砸我的BLL.
那么,在层之间传递信息的正确方法是什么?我是否还需要传递上下文?
在研究MVC 3 archetectures时,我一直看到的一个问题是将模型分解为自己的项目并将其称为ViewModels的概念.
在我编码时,我很难意识到这有什么好处.有人可以解释一下这有什么优点吗?
我已经成功地将Entity Framework 4.1与我的Sql Server一起使用了很长一段时间.
该公司正在与corportate集成,它使用DB2 iSeries 5.4.我需要弄清楚如何集成Entity Framework.
据我所知,我需要下载DB数据服务器提供程序9.7,然后应用最新的补丁,以便它可以与VS2010和EF4一起使用.
麻烦的是,我找不到任何地方下载9.7!我可以找到9.5下载区域,但没有9.7的内容.我一直在寻找6个小时.
任何人都可以为我提供一个链接,我可以用它下载我需要的工作吗?
我正在使用Visual Studio 2012和MVC 4,在我的_Layout.cshtml中,我有以下内容:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/jqgrid")
@RenderSection("head", required: false)
</head>
<body>
@RenderBody()
@RenderSection("scripts", required: false)
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在BundleConfig.cs中我有
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqgrid").Include(
"~/Scripts/jquery.jqGrid.min.js"));
}
}
Run Code Online (Sandbox Code Playgroud)
我已经三重检查,我的脚本文件夹确实包含jquery.jqGrid.min.js,但它没有包括在内.
我的Html头看起来像:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link href="/Viper/Content/css" rel="stylesheet"/>
<script src="/Viper/Scripts/jquery-1.8.1.js"></script>
<script src="/Viper/Scripts/jquery-ui-1.8.23.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)
任何想法为什么没有添加?
我有以下jQuery事件:
$("#scanItem").live("keydown", function (e) {
if (e.keyCode == 13) {
e.preventDefault();
alert('hi');
}
});
Run Code Online (Sandbox Code Playgroud)
scanItem是我页面中的文本框.
我第一次加载页面时,一切正常.按Enter键会正好触发事件一次.但是,我有一个下拉列表,它将执行jQuery加载以重新加载div.
div重新加载后,当我按下文本框上的Enter键时,警报会触发3次.
我已经在这脑子里唠叨了几个小时.任何想法为什么会这样?
我很确定我这样做是错误的,所以任何帮助都会受到赞赏......
鉴于以下plunker:http://plnkr.co/edit/hCjTdt8XmlVPKGgzvgFu?p = preview
我正在尝试编译一些Html并将其插入我模板中的特定位置.但是,我收到一个错误:
Can't interpolate: My Value: {{innerHtml}}
TypeError: Converting circular structure to JSON
Run Code Online (Sandbox Code Playgroud)
我很确定这是因为我试图将整个元素作为Html插入,但我不知道如何完成我想要做的事情.
Plunker代码:
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
</head>
<body ng-app='myApp'>
<div ng-controller='TestCtrl'>
<test-directive></test-directive>
</div>
<script>
var app = angular.module('myApp', []);
app.controller("TestCtrl", ['$scope', function($scope) {
$scope.myValue = "Hello, World!";
}]);
app.directive('testDirective', ['$compile', function($compile) {
return {
restrict: 'E',
template: "<h1>Title</h1>My Value: {{innerHtml}}",
link: function (scope, element, attr) {
scope.innerHtml = $compile("<input type='text' ng-model='myValue' />")(scope);
}
}
}]);
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我在web.config中有以下代码:
<rewrite>
<rules>
<rule name="Redirect HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
我想将除了http://www.mysite.com/manual之外的所有内容重定向到https.
如何修改以上内容以允许此操作?
angularjs ×1
architecture ×1
asp.net ×1
asp.net-mvc ×1
automapper ×1
azure ×1
bundles ×1
dataprovider ×1
db2 ×1
diagnostics ×1
ef-core-2.0 ×1
html ×1
idisposable ×1
jquery ×1
keydown ×1
publish ×1
viewmodel ×1
web-config ×1