Sometimes you have the same properties in multiple entities.
It is possible to end up duplicating the same logic in the manner of the dreaded copy-modify monster. I have learned to take it seriously when I find myself doing this because it has never not eventually come back to haunt me .
The key to making this work is to first deploy a couple of simple extension methods to make reflection a bit easier.
Then it is less daunting of a task to write a generic routine that acts on any entity set with common propertie(s).
Friday, May 18, 2012
Sunday, May 6, 2012
Minimal Code to Demonstrate Entity Framework Code First
Before compiling this, to ensure your project has a reference to a version of Entity Framework that supports code first development, execute the following nuget command:
install-package EntityFramework
The following code listing contains:
- POCO
- Context
- Static method to add an item
- Application configuration (XML)
- Unit test (not required)
Friday, May 4, 2012
PowerShell script to delete files from a directory that are more than a given number of days old.
This PowerShell
- deletes files created more than 3 days ago.
- logs the files it deletes.
Subscribe to:
Posts (Atom)