Fredrick Lackey - 242 - Aug 14, 2014

What’s the best way to clear the Id in the DTO before sending it back to the client?  Need to do this for every request.

Have them share an interface like IHasIntId and use a typed response filter, e.g:

RegisterTypedResponseFilter<IHasIntId>((req, res, dto) => dto.Id = 0);


Fredrick Lackey:

What am I missing?  I’ve added the interface to the DTO and the filter in the Configure.  It is never applied:

this.RegisterTypedResponseFilter<IClearId<long>>((req, res, dto) =>
    dto.Id = 0;

Make it a concrete interface like IClearLongId.

Fredrick Lackey:

Tried that. Actually had both examples in my reply but cleared it out to save space.

I’ve just added a example in this commit: - and it’s working as expected. If you can’t find why your’s is different can you post the full Service impl and registration code to:

Jeff Gabhart:

How about not including Id on the dto?