no dogma blog
no dogma blog
Blog Posts
Podcast
Web API Lambda Course
Polly Course
Photos
Contact
Support this Site
About
RSS
Light
Dark
Automatic
Posts
CastleWindsor chained dependency
Source code is available here. I recently had a problem where I wanted an MVC controller to use constructor injection of specified dependency and have that dependency load another specified dependency using Windsor.
Sep 8, 2014
#
Dependency Injection
Entity Framework lazy loading vs explicit loading and the generated SQL
Download the source code here. If you are using lazy loading with Entity Framework you should check that queries to the database are working as expected. A lazy load call to something like customer.
Aug 13, 2014
#
Entity Framework
,
Explicit loading
,
Lazy loading
Adding ROWGUIDCOL to Entity Framework Code First using migrations
To add add a ROWGUIDCOL to a unique identifier in a table using code first you have to use code migrations. Below is the snippet you need. I haven’t covered how to perform a migration because there are plenty of articles available.
Jul 29, 2014
#
Entity Framework
,
Migrations
Making a column sparse with Entity Framework Migrations
I have a database built off code first models, but I want to set some of the columns to sparse. There isn’t a way to this with the fluent api or through annotations.
Jul 24, 2014
#
Entity Framework
,
Migrations
Altering the ASP NET MVC model with an ActionFilter
Full source code here. Action filters are executed before and/or after the execution of an action method, they can be used to modify how an action executes or to perform a separate task, such as authorization or logging.
Jan 11, 2014
#
ActionFilter
,
ASP.NET MVC
,
AspNet
Skipping ActionFilters in ASP.NET MVC
Full source code here. In the previous post I showed how you can use an action filter to execute code both before and after an action method and how to apply the filter globally.
Jan 11, 2014
#
ActionFilter
,
ASP.NET MVC
,
AspNet
Serializing a stack to XML in C#
Serializing a class to XML in C# is straightforward; most collections can be easily serialized also. Something like the following will work in most scenarios - 1public string GetSerializedString<T>(T objectToSerialize) 2{ 3 var serializer = new XmlSerializer(typeof(T)); 4 TextWriter textWriter = new StringWriter(); 5 6 var xmlWriter = XmlWriter.
Jan 6, 2014
#
Serialization
Deserializing to an enum
I have an application where I deserialize an xml stream from a third party. One of the fields is a task code which can be one of only three values, insert, update and delete.
Dec 6, 2013
#
Serialization
,
Deserialization
Arguments model and action methods in ASP.NET MVC Part 2 - using Glimpse
In my previous post I discussed how values sent from the browser are bound to objects in the action methods of a controller. If binding is not working as expected you need to examine the html element names and the types you are binding to, I showed how the FormCollection can be of help in this regard.
Nov 12, 2013
#
ASP.NET MVC
,
AspNet
,
Glimpse
,
Model binding
Arguments model and action methods in ASP.NET MVC Part 1
Sending values from an MVC view to a controller works very well when you are binding back to the same model/viewmodel you populated the view with. But when you start trying to do something a little different, it’s not so obvious or straightforward.
Oct 15, 2013
#
ASP.NET MVC
,
AspNet
,
Dropdownlist
,
Model binding
«
»
Cite
×