.net-4.5

Failed to find or load the registered .Net Framework Data Provider

守給你的承諾、 提交于 2019-12-10 14:33:23
问题 I got the following error: "Failed to find or load the registered .Net Framework Data Provider." It only occur in AppHarbor server, not my local I use .Net mvc4 and mysql I have added MySql.Data, MySql.Data.Entity, MySql.Web to reference and set Copy Local = true. I also push bin folder to AppHarbor This is my web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,

Is WPF Hardware-accelerated when Window AllowsTransparency = true?

微笑、不失礼 提交于 2019-12-10 14:24:01
问题 I have been looking at making my own window frame in WPF, similar to Visual Studio. I have read that setting AllowsTransparency = true would force WPF to render in software-mode. This example is the source of my confusion (emphasis mine), which states: Complete customization of WPF window can be done only when AllowsTransparency is set to "True", which causes that the window is software rendered which might be not as fast GPU rendering. However, I've read elsewhere that with window layering

Is there a easy way to get the “sp_executesql” query .NET generates for a parametrized query?

和自甴很熟 提交于 2019-12-10 14:07:42
问题 Background: If I had the following program public class Program { public static void Main() { using(var connection = new SqlConnection("Server=(local);Database=Testing;Trusted_Connection=True")) using (var command = connection.CreateCommand()) { connection.Open(); command.CommandText = "UPDATE Foo set Bar = @Text"; command.Parameters.Add("@Text", SqlDbType.VarChar, 50).Value = "Hello World!"; command.ExecuteNonQuery(); } } } When executed the following query is run (according to SQL Server

Replacement of Self-tracking entities in Entity Framework 6

蹲街弑〆低调 提交于 2019-12-10 14:03:11
问题 I am sure most of .NET developers must be facing this issue one way or the other. The problem is simple, I am upgrading my project from .NET 4 to .NET 4.5.1 . So far so good the upgrade went neatly. But when I upgraded from EF4 to EF6, I did encounter lot of bugs in my queries. Some of these were related to renaming the context which I did, but as for the errors related to Self-tracking entities , I am a little confused. Self-tracking entities are a major part of my project and EF6 not

HttpClient HttpResponseMessage Address / URI

谁说我不能喝 提交于 2019-12-10 13:37:47
问题 I am developing a C# WinRT application that makes POST and GET requests to a webserver. Does anyone know if there is a way to get the Response URI / Address when using a HttpClient object?. If I use the HttpWebRequest / HttpWebResponse classes, then I can get this information (via the ResponseUri property in HttpWebResponse), but I don't see how to obtain it using the HttpClient / HttpResponseMessage classes. Thanks 回答1: This is two years old, but I just came across this question with the

Akka.net starting and stopping with no activity

别说谁变了你拦得住时间么 提交于 2019-12-10 11:34:40
问题 I'm trying to send a message from a typesafe akka actor in Scala (2.4.11) to Akka.net actor in C# (1.0.4) I have a weird problem with my .Net actor, it keeps saying started then stopped, but I have no clue whats happening under the hood: A piece of Akka.net log: 2015-11-18 16:23:57.6168|DEBUG|Akka.Remote.Transport.ProtocolStateActor|Started (Akka.Remote.Transport.ProtocolStateActor) 2015-11-18 16:24:27.6578|DEBUG|Akka.Remote.Transport.ProtocolStateActor|Stopped 2015-11-18 16:24:42.6344|DEBUG

How to escape a string in system.data.sqlite?

不羁的心 提交于 2019-12-10 11:19:41
问题 I am executing an SQL query (system.data.SQLite) like so: var color = "red"; var command = new SQLiteCommand("SELECT something FROM tabletop WHERE color = '" + color + "'", Connection); var reader = command.ExecuteReader(); The color variable is a text supplied by the user. How can I escape this text to prevent SQL injection? Or is this bad practice and I should execute the query in some entirely different "protected" way? 回答1: You should use parameterized queries: var command = new

What is the best way to return completed Task?

谁说我不能喝 提交于 2019-12-10 10:59:51
问题 What is the best way to return a completed Task object? It is possible to write Task.Delay(0), or Task.FromResult<bool>(true) whatever. But what is the most efficient way? 回答1: Answer from Stephen Toub (MSFT): If you want a new Task object each time, Task.FromResult is the most efficient. Task.Delay(0) in its current implementation will return a cached task, but that's an implementation detail. If you want to use a cached task, you should cache one yourself, e.g. private static readonly Task

DataGridView button text not appearing despite UseColumnTextForButtonText set to true

你说的曾经没有我的故事 提交于 2019-12-10 10:16:14
问题 I've added a button column to a DataGridView and want to display the text "Compare" on it. I've set the Text property to Compare and UseColumnTextForButtonValue to True, but no text displays: This is also true at runtime, so it's not just not displaying in the designer: How do I get the text to appear? Edit: For prosperity's sake, here's the code in the generated Designer.cs file. I haven't added any code to this form myself yet, so there's no chance that something's resetting it further down

async await usages for CPU computing vs IO operation?

好久不见. 提交于 2019-12-10 09:25:25
问题 I already know that async-await keeps the thread context , also handle exception forwarding etc.(which helps a lot). But consider the following example : /*1*/ public async Task<int> ExampleMethodAsync() /*2*/ { /*3*/ var httpClient = new HttpClient(); /*4*/ /*5*/ //start async task... /*6*/ Task<string> contentsTask = httpClient.GetStringAsync("http://msdn.microsoft.com"); /*7*/ /*8*/ //wait and return... /*9*/ string contents = await contentsTask; /*10*/ /*11*/ //get the length... /*12*/