I am looking for an ORM to use with .net, I need to be able to do full graph serialization to Xml on the entitys the ORM generates. My own research leads me towards using the WCF and the Entity Framework to achieve this, Is this the best option or is there a simpler way ?
Share
Well, most ORM tools can emit standard POCO .NET classes, and most standard POCO classes lend themselves to serialization quite well. For example, LINQ-to-SQL has support for
DataContractSerializer(notXmlSerializer) by settingSerialization ModetoUnidirectional. Entity Framework does the same (I don’t think you need to change any settings for EF, though).For ‘simpler’ – well, what is the complexity? Setting up an Entity Framework (or LINQ-to-SQL) model isn’t usually very tricky. Anything specific being problematic?
Note that xml serializers, by default, are tree serializers, not graph serializers.
DataContractSerializercan support proper graphs, but you need to enable it (it isn’t enabled by default in xml mode, since it produces very odd-looking xml).You mention WCF; that is a communications technology; you don’t mention comms in the question, so it isn’t clear what you mean here. Note that ‘ADO.NET Data Services’ is another option here, if you want REST-based data-access, but most ORMs should work OK with WCF. There are alternatives, of course.