This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I use the designer within a windows WCF service which works fine in general. But there is one big problem I am messing around with. I try to use the designer generated classes directly for my data contracts like this:
This works quite well, but with every change of the data modell all entities are rewritten and all my attributes are lost. Do you have an idea how I can get around this? I can write another proxy (DataContract) class for each entity but that couldn't be the solution. Thanks, Kay |
|
|
Hello Kay, One possible solution is to edit the designer code generation templates. This may sound a bit intimidating but for a simple change like this it is actually reasonably easy. However, we have had WCF attribute support on our radar for a while so we have now implemented it for you. It will be included in the next nightly build which you will be able to get from the Mindscape store or Downloads page (NOT through the Visual Studio Extension Manager) from about 1200 GMT. There is now a Generate Data Member Attribute option for properties (we will automatically emit DataContract on an entity if any property has Generate Data Member Attribute set). Set this on the properties you want to include in the WCF contract and you should be good to go. Please treat this feature as beta -- let us have your feedback and do let us know if you run into any problems. (NOTE: When you download the update it may arrive as a .zip file instead of a .vsix. If so, rename it to .vsix before installing it (do not unzip it!). We are working on a fix for this issue.) |
|
|
Hi Ivan, WOW, that's what I call customer support! I will try it today and give you feedback. Thank a lot, Kay |
|
|
Just wanted to report, it works perfect :-) Thanks, Kay |
|
|
Hi, after having some time to continue my work on the project, I stumbled upon one more thing. As I said, I work with WCF services and for me it would be very nice, if I could retrieve "full" objects over the service. Here is an example, what I need: I have an entity, let's say "Role" which should have a list of "RoleRights". Your designer creates something like that:
[System.Runtime.Serialization.DataContract] public partial class Role { [System.Runtime.Serialization.DataMember] public virtual int Id { get; set; } [System.Runtime.Serialization.DataMember] public virtual string RoleName { get; set; }
As you can see "Id" and "Rolename" are Datamembers which can be transferred over the service. The association to "RoleRights" (Role.RoleRights<>), which is stored in the above code correctly, will never be available through the WCF service, because it's missing the "Datamember" attribute. I don't know how to achieve this, but somehow it would be nice to be able to add the "Generate Data Member" property to associations too, to get something like this:
{ [System.Runtime.Serialization.DataMember] public virtual int Id { get; set; } [System.Runtime.Serialization.DataMember] public virtual string RoleName { get; set; }
I hope you understand what I mean. Thanks, Kay |
|
|
Hi Kay, No problem. It will be in the next nightly build. Similar to properties, except a one-to-many association will have two 'generate DataMember' options, for the collection and the backreference. The nightly build should be up around 1200 GMT. However, our overnight uploader is being a bit tetchy at the moment so you may not see it until 24 hours later -- you need to wait for a build dated 5 April or above. (We're working on fixing the delay!) |
|