I am involved in development of a tiered application that uses LINQ2SQL separated from the web server with a NET.TCP Binding on WCF.
My questions are:
- What sort of measures should I take to achieve the best performance?
- Since the entity objects returned by the LINQ need to be converted to a IEnumerable list to be serialized everytime, is there anyway to remove this dependency?
1) Concentrate on a properly normalized database design. I would say that when you are forced to make design tradeoffs in your code vs. database design, if performance is your goal, make tradeoffs in your object design instead of your database design. Understand that you aren’t going to be able to do a proper supertype/subtype database design which will work with Linq to SQL (I’m told you need to use the EF instead).
2) Depends what you mean here. If you’re asking how you would serialize anonymous classes across the wire, the easy answer is: ‘you can’t, so don’t try’. If you want to put lists of objects across the wire, just use the ToArray() extension method on your IEnumerable collections to ship arrays of your business objects over the wire.