Archives for n-Tier Apps - Page 2
FindAsync with non-primary key value
var foos = await (x => == userId).ToListAsync();
Quick way to print out generated sql
If you are working from an EF context, the context has its own LOG. This can be written out to your development console (see example below). = ;DataClassesDataContext context =…
Visualizing EDMX files (entity framework data model)
Ever wanted to reverse engineer a code-first Entity framework model ? Or simply generate a diagram from an existing model? Try the Entity Framework Power Tools. Power Tools
Converting a normal collection to IEnumerable
Suppose you are stuck with a namevaluecollection – it is not of type IQueryable or IEnumerable. So – none of your LINQ queries will work on it. Convert it to…
Update EDMX model with database changes
Open the EDMX file within Visual Studio – use an Open With command from the right click menu Open With -> Entity Data Model Designer Right click on the designer…
Linqer–Convert SQL statements to LINQ
LINQPad, the most popular LINQ tool out there , does not convert SQL statements into their equivalent LINQ syntax. However, a free tool called Linqer does just that. Linqer takes…
Inheriting an existing Entity Framework Implementation
Several quirks may pop up – the project may not work seamlessly in your local environment. Entity Framework generates a slew of files – most notably its mapping file (with…
Entity Framework–where to put the data folder
In your folder structure, where shoul you put the edmx data folder? As all EDMX files are representations (abstractions) of some relational database, they belong in the Models folder. The…
Hibernating Rhinos – nHibernate Profiler
1. To get started with this powerful profiler, simply install the NuGet package (look for nHibernate Profiler). it places all the required assemblies in your project AND…
nHibernate transactions and rollbacks
Introduction The same rollback considerations that apply to normal SQL transactions also apply to nHibernate transactions. Rollback Scenario Suppose you have two SQL Statements – the first one tries to…