将存储过程导入我的datamodel后,项目停止编译.
它一直给我错误:
The best overloaded method match for
'System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction<TicketDataModel.sp_get_orphanjobgrades1_Result>
(string, params System.Data.Entity.Core.Objects.ObjectParameter[])'
has some invalid arguments C:\Users\nikolaev\Documents\MySoft\TicketManager-06 11 2013\TicketManager\TicketDataModel\TicketDataModel\TicketEntities.Context.cs 105 20 TicketDataModel
Run Code Online (Sandbox Code Playgroud)
和
`Argument 3: cannot convert from 'System.Data.Objects.ObjectParameter' to
'System.Data.Entity.Core.Objects.ObjectParameter'
C:\Users\nikolaev\Documents\MySoft\TicketManager-06 11 2013\TicketManager\TicketDataModel\TicketDataModel\TicketEntities.Context.cs 79 143 TicketDataModel`
Run Code Online (Sandbox Code Playgroud)
代码context.cs如下:
public virtual ObjectResult<sp_get_orphanjobgrades1_Result> sp_get_orphanjobgrades1(Nullable<System.DateTime> start_date, Nullable<System.DateTime> end_date)
{
var start_dateParameter = start_date.HasValue ?
new ObjectParameter("start_date", start_date) :
new ObjectParameter("start_date", typeof(System.DateTime));
var end_dateParameter = end_date.HasValue ?
new ObjectParameter("end_date", end_date) :
new ObjectParameter("end_date", typeof(System.DateTime));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_get_orphanjobgrades1_Result>("sp_get_orphanjobgrades1", start_dateParameter, end_dateParameter);
}
Run Code Online (Sandbox Code Playgroud)
我读到这可能是因为EF 6并且需要为VS 2012下载VS …
我是Angular的新手,仍然痛苦地围绕自定义指令.
我想重用这一点HTML
<ui-select ng-model="model.selectedLanguages" multiple search-enabled="true" theme="select2" style="width: 300px;">
<ui-select-match placeholder="Pick one...">{{$item.name}}</ui-select-match>
<ui-select-choices repeat="lang.id as lang in langs |filter: { name : $select.search }">
<div ng-bind-html="lang.name | highlight: $select.search" ></div>
</ui-select-choices>
</ui-select>
Run Code Online (Sandbox Code Playgroud)
通过将其包装到我的自定义指令中:
<language-picker ng-model="model.selectedLanguages"/>
Run Code Online (Sandbox Code Playgroud)
这样的事情:
app.directive('languagePicker', function() {
return {
template : '<ui-select ng-model="**PARENT'S NGMODEL**" multiple search-enabled="true" theme="select2" style="width: 300px;"><ui-select-match >{{$item.name}}</ui-select-match><ui-select-choices repeat="lang.id as lang in langs | filter: { name : $select.search }"><div ng-bind-html="lang.name | highlight: $select.search"></div></ui-select-choices></ui-select>',
restrict : 'E',
require : 'ngModel',
replace : true
....
};
}); …Run Code Online (Sandbox Code Playgroud) 我使用Unity来解析实现该接口的具体类型的通用接口:
_container.RegisterType<IItemLocatorFactory<Job, ILocatorViewModel<Job>>,
ItemLocatorFactory<Job, BaseJobViewModel>>();
Run Code Online (Sandbox Code Playgroud)
声明IItemLocatorFactory<Job, ILocatorViewModel<Job>>是:
public interface IItemLocatorFactory<TData, TModel>
where TData : IMyEntity
where TModel : ILocatorViewModel<TData>
Run Code Online (Sandbox Code Playgroud)
该类ItemLocatorFactory<Job, BaseJobViewModel>实现了接口IItemLocatorFactory<Job, ILocatorViewModel<Job>:
public class ItemLocatorFactory<T, TModel> : IItemLocatorFactory<T, TModel>
where T : IMyEntity
where TModel : ILocatorViewModel<T>
Run Code Online (Sandbox Code Playgroud)
该类BaseJobViewModel声明如下:
public class BaseJobViewModel : ILocatorViewModel<Job>
Run Code Online (Sandbox Code Playgroud)
但这给了我编译错误抱怨没有隐式引用转换:
错误1类型'UI.ItemLocator.Infrastructure.DefaultItemLocatorFactory.ItemLocatorFactory'不能在泛型类型或方法'Microsoft.Practices.Unity.UnityContainerExtensions.RegisterType(Microsoft.Practices.Unity.IUnityContainer,params)中用作类型参数'TTo'. Microsoft.Practices.Unity.InjectionMember [])".从'UI.ItemLocator.Infrastructure.DefaultItemLocatorFactory.ItemLocatorFactory'到'Interfaces.UI.ItemLocator.IItemLocatorFactory>'没有隐式引用转换.
我在这里弄错了什么?
我在Azure上部署了一个ASP.NET 5 MVC 6应用程序,并使用SignalR 2遇到了这个问题:从客户端启动连接时,调用
/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B"name"%3A"gameHub"%7D%5D&_=1460028930688
Run Code Online (Sandbox Code Playgroud)
失败,错误500.
错误500背后的例外是:
异常详细信息:System.Security.Cryptography.CryptographicException:数据保护操作失败.这可能是由于没有为当前线程的用户上下文加载用户配置文件引起的,这可能是线程模拟时的情况.
来源错误:
在执行当前Web请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息.
堆栈跟踪:
[CryptographicException:数据保护操作失败.这可能是由于没有为当前线程的用户上下文加载用户配置文件引起的,这可能是线程模拟时的情况.
我在AzureWebsites上阅读并尝试了在SignalR CryptographicException上建议的解决方案,但id对我不起作用.
据我了解,Azure不允许LoadUserProfile.
任何解决方法?
我正在尝试使用SignalR构建一个简单的ASP.NET 5应用程序,它应该定期将消息推送到客户端(例如,实现一个仪表板,其值从服务器推送到浏览器.)
我研究了一些职位如http://arulselvan.net/realtime-dashboard-asp-net-signalr-angularjs-d3js/或http://henriquat.re/server-integration/signalr/integrateWithSignalRHubs.html.他们建议在IRegisteredObject从System.Web.Hosting命名空间实现的类中实现一个计时器.
但是,我似乎无法找到IRegisteredObjectASP.NET 5中System.Web不再存在的名称空间.我无法在线查找任何信息.ASP.NET 5中它的替代品是什么?
UPDATE
我正在尝试以下解决方案:
创建一个封装计时器的服务
将其注册Startup.cs为单例服务,例如
public class Ticker
{
Timer timer = new Timer(1000);
public Ticker()
{
timer.Elapsed += Timer_Elapsed;
timer.Start();
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
// do something
}
}
Run Code Online (Sandbox Code Playgroud)在 Startup.cs
public void ConfigureServices(IServiceCollection services)
{
// ...
Ticker ticker = new Ticker();
ServiceDescriptor sd = new ServiceDescriptor(typeof(Ticker), ticker);
services.Add(sd);
// ...
}
Run Code Online (Sandbox Code Playgroud)
这种方法怎么样?
我正在从这里使用自动完成修改编辑控件: 自动从文本文件追加/完成到编辑框delphi
我想从DB加载自动完成字符串.我在自动完成控件后代上声明了新属性:
FACDataSource : TDataSource;
FACFieldName : string;
Run Code Online (Sandbox Code Playgroud)
我这称之为加载自动完成字符串:
procedure TAutoCompleteEdit.ReadSuggestions;
begin
FAutoCompleteSourceList.Clear;
if (not Assigned(FACDataSource)) or (not Assigned(FACDataSource.DataSet)) or (not ACEnabled) then
exit;
with FACDataSource.DataSet do
begin
if Active and (RecordCount > 0) and (FACFieldName <> '') then
begin
First;
while not EOF do
begin
FAutoCompleteSourceList.Add(FACDataSource.DataSet.FieldByName(FACFieldName).AsString);
Next;
end;
if FAutoCompleteSourceList.Count > 0 then
ACStrings := FAutoCompleteSourceList;
end;
Run Code Online (Sandbox Code Playgroud)
结束; 结束;
但是,我分配时收到AccessViolation FAutoCompleteSourceList到ACStrings.设定者ACStrings是:
procedure TAutoCompleteEdit.SetACStrings(const Value: TStringList);
begin
if Value <> FACList.FStrings then
FACList.FStrings.Assign(Value);
end; …Run Code Online (Sandbox Code Playgroud) 我有一个泛型类,应该IQueryable通过调用此方法来过滤,排序,投影和分页:
public async Task<PagedResult<TResult>> GetFilteredOrderedPageAsync<TResult>(IQueryable<TSource> source,
IFilterModel filterModel,
ISortModel sortModel,
int page, int pageSize,
Expression<Func<TSource, TResult>> converter)
where TResult : class
{
var filtered = Filter(source, filterModel);
var projected = filtered
.Select(converter)
.Distinct();
var ordered = Sort<TResult>(projected, sortModel);
var result = await GetPageAsync<TResult>(ordered, page, pageSize, converter);
return result;
}
Run Code Online (Sandbox Code Playgroud)
我在Distinct()这里打电话
var projected = filtered
.Select(converter)
.Distinct();
Run Code Online (Sandbox Code Playgroud)
删除投影后可能出现的任何重复项.
我的假设是EF6会产生类似的东西
SELECT DISTINCT Col1, Col2, Col3 FROM (SELECT Col1, Col2, Col3, Col4 FROM SOME_TABLE WHERE <some conditions on co1, …Run Code Online (Sandbox Code Playgroud) AutoMapper IQueryable Extension's Project().To<TViewModel>().SingleOrDefault()抛出此异常:
无法比较'App.Domain.MyComplexType类型的元素.仅支持基本类型,枚举类型和实体类型.
我有这个型号:
public class MyEntityType // this is an entity type on the dbContext
{
public int Id {get;set;
public MyComplexType MyComplexType {get;set;}
}
public class MyComplexType // this is a complex type
{
public decimal Property1 { get; set;}
public string Property2 { get;set;}
}
public class ViewModel
{
public int Id { get;set;}
public decimal MyComplexTypeProperty1 { get;set;}
}
Run Code Online (Sandbox Code Playgroud)
我使用AutoMapper配置映射IQueryable<MyEntityType>到ViewModel:
Mapper.CreateMap<MyEntityType, MyComplexType>(); // I rely on AutoMapper's
//convention for …Run Code Online (Sandbox Code Playgroud) 我从 VueError in v-on handler: "TypeError: this.$confirm is not a function调用 Element UI 时得到this.$confirm:
也许我没有导入我应该导入的东西(文档和示例表明不需要额外的导入)?
我正在尝试使用 Element UI 构建一个 Vue 应用程序。它有一个表格,每行都有一个删除按钮。单击处理程序调用this.$confirm以向用户显示确认对话框。我从 Element 文档中不太清楚,但似乎 Element 扩展了 Vue 组件,$confirm开箱即用。
模板:
<el-table-column label="" width="180">
<template slot-scope="scope">
<el-button circle type="danger" @click="beginRemove(scope.row)">
X
</el-button>
</template>
</el-table-column>
Run Code Online (Sandbox Code Playgroud)
脚本:
<script>
import * as API from '../../services/data.js'
import { ElementUI, MessageBox } from 'element-ui'; // ???
export default {
...
methods: {
beginRemove(item) {
this.$confirm(`Do you really want to delete …Run Code Online (Sandbox Code Playgroud) c# ×4
javascript ×2
signalr ×2
angularjs ×1
asp.net ×1
asp.net5 ×1
autocomplete ×1
automapper ×1
azure ×1
controls ×1
delphi ×1
element-ui ×1
generics ×1
interface ×1
linq ×1
timer ×1
vue.js ×1
vuejs2 ×1