views:

125

answers:

1

Each our table has column TenantID. Normally we slice data with NHibernate filters. We need the same for Entity Framework Model.

We will use this model as source for ADO.NET Data Services, so it is better to have model free of infrastructure properties like TenantID. From code side we know TenantID thread statically.

UPD: I found QueryInterceptorAttribute, investigating if I can use it.

A: 

You might want to look into using T4 templates. There is a good example here, it would just need to be modified a bit.

I have also used anonymous types to 'slice' properties off of Entity Framework objects.

//assuming EFObject has Foo, Bar and Baz properties
var slicedObject = new { Foo = EFObject.Foo, Bar = EFObject.Bar }

It simple, but questionably maintainable for complex classes.

gaustin