Encoding parameters for a URL

I have a Silverlight application that is building a URL. This URL is a call to a REST-based service. This service expects a single parameter that represents a location. The location is in the form of “city, state”. To build this URL, I’m calling the following code: string url = “http://www.example.com/myService.svc/”; url += HttpUtility.UrlEncode(locationTextBox.Text); If … Read more

Internal .NET Framework Data Provider error 1025

IQueryable<Organization> query = context.Organizations; Func<Reservation, bool> predicate = r => !r.IsDeleted; query.Select(o => new { Reservations = o.Reservations.Where(predicate) }).ToList(); this query throws “Internal .NET Framework Data Provider error 1025” exception but the query below does not. query.Select(o => new { Reservations = o.Reservations.Where( r => !r.IsDeleted) }).ToList(); I need to use the first one because … Read more

how to create an animated gif in .net

Does anyone know how to create an animated gif using c#? Ideally I would have some control over the color reduction used. Is using imagemagick (as an external started process) the best choice? Answer This Gif Animation Creater code from https://github.com/DataDink/Bumpkit can set Delay foreach Frame: Uses .Net standard Gif Encoding and adds Animation headers. … Read more

Multiple SQL statements in one roundtrip using Dapper.NET

There is a nice feature in ADO.NET that allows you to send multiple SQL statements to database in one roundtrip and receive results for all statements: var command = new SqlCommand(“SELECT count(*) FROM TableA; SELECT count(*) FROM TableB;”, connection); using(var reader = command.ExecuteReader()) { reader.Read(); resultA = reader.GetInt32(0); reader.NextResult(); reader.Read(); resultB = reader.GetInt32(0); } Is … Read more

ASP.NET Web Api – Startup.cs doesn’t exist

I have an ASP.NET Web Api solution which doesn’t contain a Startup.cs class. I presume this is because the solution wasn’t created as an MVC solution. All the code for the startup is defined in the Global.asax.cs file as you can see below public class Global : HttpApplication { void Application_Start(object sender, EventArgs e) { … Read more

Does .Disposing a StreamWriter close the underlying stream?

The StreamWriter.Close() says it also closes the underlying stream of the StreamWriter. What about StreamWriter.Dispose ? Does Dispose also dispose and/or close the underlying stream Answer StreamWriter.Close() just calls StreamWriter.Dispose() under the bonnet, so they do exactly the same thing. StreamWriter.Dispose() does close the underlying stream. Reflector is your friend for questions like this 🙂 … Read more