我正在尝试在我的机器上安装的TeamCity上运行我的测试.
System.InvalidOperationException:实体框架提供程序类型" 为" 'ADO.NET提供程序无法加载.确保提供程序程序集可用于正在运行的应用程序.
System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServerVersion=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'System.Data.SqlClient
我没有参考System.Data.Entity任何我在codeplex上建议升级到EF6的项目.
所以,我不知道为什么我会得到这个例外.当我从VS运行测试时,我没有得到任何这样的异常.
我确实尝试将CopyLocal设置为false然后再次设置为true ..但这似乎也不起作用.
更新
我的app.config有以下内容.这会导致一些我不理解的行为吗?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我在teamcity中得到以下stacktrace.
[MSTest] IntegrationTests.CrudTest+QuestionTest.Create
[03:59:11][IntegrationTests.CrudTest+QuestionTest.Create] Initialization method IntegrationTests.CrudTest+QuestionTest.Initialize threw exception. System.InvalidOperationException: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' for the 'System.Data.SqlClient' …Run Code Online (Sandbox Code Playgroud) 我正在使用Json.Net将XML序列化为Json.当我将序列化的字符串写入文件时,它只是一行.我如何通过常用标签和缩进实际看起来像Json?
我有一个python-pandas-dataframe,其中第一列是user_id,其余列是标签(tag_0到tag_122).我有以下格式的数据:
UserId Tag_0 Tag_1
7867688 0 5
7867688 0 3
7867688 3 0
7867688 3.5 3.5
7867688 4 4
7867688 3.5 0
Run Code Online (Sandbox Code Playgroud)
我的目标是Sum(Tag)/Count(NonZero(Tags))为每个user_id 实现
df.groupby('user_id').sum(),给我sum(tag),但是我对计算非零值一无所知
是否有可能Sum(Tag)/Count(NonZero(Tags))在一个命令中实现?
在MySQL中我可以实现如下: -
select user_id, sum(tag)/count(nullif(tag,0)) from table group by 1
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
我看到我有三个可能的地方插入我的东西在管道中
1) AuthorizationFilters
2) Action Filters
3) DelegatingHandler
Run Code Online (Sandbox Code Playgroud)
最明显的一个是AuthorizationFilters,我可以使用自定义授权属性来装饰我的动作/控制器.说.. MyCustomAuthorizationAttribute.
由于HTTP消息处理程序处于处理管道的第一阶段.把它放在那里是否有意义?
我现在的授权仅仅意味着检查标头中的标记,该标记在认证后被提供给客户端.
我正在尝试使用Rx在wpf中实现标准的拖放图像.
var mouseDown = from evt in Observable.FromEventPattern<MouseButtonEventArgs>(image, "MouseLeftButtonDown")
select evt.EventArgs.GetPosition(image);
var mouseUp = Observable.FromEventPattern<MouseButtonEventArgs>(this, "MouseLeftButtonUp");
var mouseMove = from evt in Observable.FromEventPattern<MouseEventArgs>(this, "MouseMove")
select evt.EventArgs.GetPosition(this);
var q = from startLocation in mouseDown
from endLocation in mouseMove.TakeUntil(mouseUp)
select new Point
{
X = endLocation.X - startLocation.X,
Y = endLocation.Y - startLocation.Y
};
q.ObserveOn(SynchronizationContext.Current).Subscribe(point =>
{
Canvas.SetLeft(image, point.X);
Canvas.SetTop(image, point.Y);
});
Run Code Online (Sandbox Code Playgroud)
我收到错误错误 Cannot convert lambda expression to type 'System.IObserver<System.Windows.Point>' because it is not a delegate type
我错过了什么?
Schemaless是一个目前在NoSql世界中浮现的术语.
我有一个自定义DatabaseInitialiser,如下所示
/// <summary>
/// Implements the IDatabaseInitializer to provide a custom database initialisation for the context.
/// </summary>
/// <typeparam name="TContext">TContext is the DbContext</typeparam>
public class ParikshaDataBaseInitializer<TContext> : IDatabaseInitializer<TContext> where TContext : DbContext
{
/// <summary>
/// The method to Initialise the database.
/// Takes care of the database cannot be dropped since it is in use problem while dropping and recreating the database.
/// </summary>
/// <param name="context">The DbContext on which to run the initialiser</param>
public void InitializeDatabase(TContext context) …Run Code Online (Sandbox Code Playgroud) c# entity-framework ef-code-first ef-migrations entity-framework-6
一切都在今天工作,直到它停止...以下是最小的源代码(我正在使用VS 2012 Update 1 .Net 4.5).当我运行它时,app会在调用client.PostAsync()时退出,因此它永远不会到达Console.ReadLine().在调试器中也一样,没有例外,没有,退出代码0.
我尝试重新启动机器,重新启动VS2012 - 没有任何作用.
同样,今天一切都在运行,不确定发生了什么变化(没有安装任何软件等,所有其他网络应用仍然有效).
有任何想法吗?我想我正在失去理智.
class Program
{
static void Main(string[] args)
{
Run();
}
private async static void Run()
{
using (var client = new System.Net.Http.HttpClient())
{
var headers = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("submit.x", "48"),
new KeyValuePair<string, string>("submit.y", "15"),
new KeyValuePair<string, string>("submit", "login")
};
var content = new FormUrlEncodedContent(headers);
HttpResponseMessage response = await client.PostAsync("http://www.google.com/", content);
Console.ReadLine();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在序列化,一个 MultiDictionary<String,Object>
http://powercollections.codeplex.com/给json.
它有618个元素,其中元素是深层嵌套的,即单个Object可能有几个类似于字典的对象.我正在使用JSON.Net
String json = JsonConvert.SerializeObject(json, Newtonsoft.Json.Formatting.Indented);
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
更多信息: - 这是正常工作,直到我使用动态,我不得不切换到MultiDictionary允许同名的多个属性.它适用于大多数情况,只有当项目数量很大时才会中断.
更新: -
我已经能够控制内存消耗,但减少了一些递归添加到每个元素的元素.
我在prod服务器日志中看到错误; 你能否给我一些关于哪种情况会引发错误的暗示?谢谢.
Token PropertyName in state Start would result in an invalid JavaScript object.
2010-08-02 04:33:56,446 DEBUG 10 XXX - at Newtonsoft.Json.JsonWriter.AutoComplete(JsonToken tokenBeingWritten)
at Newtonsoft.Json.JsonWriter.WritePropertyName(String name)
Run Code Online (Sandbox Code Playgroud)