Tip 38 – How to use CodeOnly with Astoria

The normal way that you create an ADO.NET Data Services (aka Astoria) Service is by creating a class that derives from DataService<T>. public class BloggingService : DataService<BloggingEntities> And if you want to use Entity Framework under the hood the T you supply must derive from ObjectContext. Now this works great most of the time, but…

0

Code-Only best practices

There have been lots of posts on the EFDesign blog talking about how the features in Code Only have evolved. But very little covering what we think will be the best way to write the code. You may have seen code like this: var prodConf = builder.Entity<Product>(); productConf.HasKey(p => p.Id); productConf.Property(p => p.Id).IsIdentity(); productConf.Property(p =>…

3

Tip 37 – How to do a Conditional Include

Problem Someone asked how to do a Conditional Include a couple of days ago on StackOverflow. They wanted to query for some entity (lets say Movies) and eager load some related items (lets say Reviews) but only if the reviews match some criteria (i.e. Review.Stars == 5). Unfortunately though this isn’t strictly supported by EF’s…

13

Tagging File Systems?

I had an interesting in passing conversation with someone today about tagging file systems… which reminded me of my own sordid past. Before I joined Microsoft, before I was an MVP, before I released Base4, I wrote something called XTend. At the time I called it a relational file system, but this was back in…

6