C-Sharp

A collection of 31 posts
C-Sharp

EntityFramework, slow insert and SqlBulkCopy

Hey all, I finally got fed up with the ridiculously slow insert times of EntityFramework. So, I went with the SqlBulkCopy route, but that required a second connection to the database, and second connection string in the config file, you're not storing them in the code right...? Well, I created some extension methods to handle this all for me, this takes care of getting the SqlConnection out of the Entity Context. Below is the code to do it. public static class ObjectContextExtensions { ///
1 min read
C-Sharp

Converting non MVC3 projects to MVC3 projects

Well, I needed to do this because the project that the codgen tool in Orchard creates is not an MVC3 project. Call me picky, but I like the Add Control, Goto View, Create View, and all the other cool little things that come with an MVC project in Visual Studio. So, I set out to figure out how to do it. It's pretty easy, in the .csproj file, there is a project type GUIDs element. Starts out as something like this: <ProjectTypeGuids>{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> just
C-Sharp

iTextSharp and Windows SSL Certificates

Well, it took a bit of work, but I figured out how to add certificates and intermediate certificates into a PDF document while signing it using iTextSharp. The examples they had were close, but not quite there. They had hard coded the buffer size to 4000. Seemed a bit small, it got real tight when I had 2 intermediate certificates, so I made a change to that to use a more dynamic approach. I did a 4000 + RawData.Length for each certificate. Definitely opened up some more room to fit everything i
3 min read