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
Entity Framework Migrations with an existing database
Introduction If you read my post on Entity Framework migrations, you might be saying, “that’s amazing, but that’s all very well for new projects, but we’ve got eighty tables in place already and that code first migration ship has sailed”.
May 11, 2015
#
Entity Framework
,
Migrations
Finding the Location of a Running Assembly in .Net
For many reasons you might want to know where a running assembly is located on your filesystem. I had to do this once when I was compiling classes at runtime and had a dependency on EntityFramework.
May 1, 2015
#
Assembly location
,
Dynamic compilation
Entity Framework non null foreign key migration
Full source code is provided. Overview This post gives a quick overview of how to use Entity Framework migrations and a detailed example of how to handle the addition of a new non null foreign keyed column to an existing table with data in it.
Apr 30, 2015
#
Database
,
Entity Framework
,
Migrations
Mass Transit with RabbitMQ Hello World
Full source code is available here. Below is an example of how to use RabbitMQ with Mass Transit service bus. See here for instructions on how to install Rabbit MQ.
Apr 13, 2015
#
Mass Transit
,
RabbitMQ
,
Service Bus
Complex model validation using Fluent Validation
Full source code is available here. A common problem is validating an object using a complicated set of rules. I started using the Fluent Validation package some time back, it is commonly used with MVC and Web API applications but can be used with in any scenario that requires validation.
Apr 10, 2015
#
Fluent Validation
,
Validators
Using JSON to store application preferences and configuration
Download full source code. Storing configuration preferences in the database is not a hard task. It usually involves storing the name of the preference, the value and the type in the database.
Apr 6, 2015
#
Entity Framework
,
JSON
Saving enums as strings with Entity Framework
In September 2018 I wrote a new post explaining how to store enums as ints or strings with Entity Framework Core. It is a nicer solution than the one presented here.
Nov 23, 2014
#
Entity Framework
,
Enum
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
«
»
Cite
×