Why does Microsoft do this to me
-
So each version of Silverlight that comes out I take a look and see how the technology is progressing. I finally got to SL4. This may be user error but I'm really frustrated with the data access. I first tried POCO, using my own objects from the server. Got those passed through WCF and bound but then you can't use the DataAnnotations (I like the ID of having the validations for the data where the data lives in the class) when you bind on the client. Then I went to the WFC Data Service model using MVVM. Looked good but then guess what, same issue. Lastly I went to RIA but couldn't figure out how to add an object on the client. Evidently MS didn't build my Insert function on the Domain Service. So I went to go look for myself. So many generated functions with odd attributes my eyes hurt. I’ve looked at videos which all simply just edit objects but don’t add anything. But if they would I can get the DataAnnotations working with RIA but I have to do this kludgy Metadata object. So is there a better way or am I doing something wrong? I hate MS generated black boxes because they tend not to work for real applications and then when something does go bump in them you spend hours on google researching only to find out you are so in bed with them you have to wait till next release to get it fixed. I’m just about to create my own Data layer architecture for working with SL but before I do I thought I would do a sanity check with the guru’s. What did I miss? Is there a better way?
-
So each version of Silverlight that comes out I take a look and see how the technology is progressing. I finally got to SL4. This may be user error but I'm really frustrated with the data access. I first tried POCO, using my own objects from the server. Got those passed through WCF and bound but then you can't use the DataAnnotations (I like the ID of having the validations for the data where the data lives in the class) when you bind on the client. Then I went to the WFC Data Service model using MVVM. Looked good but then guess what, same issue. Lastly I went to RIA but couldn't figure out how to add an object on the client. Evidently MS didn't build my Insert function on the Domain Service. So I went to go look for myself. So many generated functions with odd attributes my eyes hurt. I’ve looked at videos which all simply just edit objects but don’t add anything. But if they would I can get the DataAnnotations working with RIA but I have to do this kludgy Metadata object. So is there a better way or am I doing something wrong? I hate MS generated black boxes because they tend not to work for real applications and then when something does go bump in them you spend hours on google researching only to find out you are so in bed with them you have to wait till next release to get it fixed. I’m just about to create my own Data layer architecture for working with SL but before I do I thought I would do a sanity check with the guru’s. What did I miss? Is there a better way?
WCF RIA Services will give you the most RAD help with dataannotations. The metadata object may seem kludgy but it's not so bad. The code it is decorating is Visual Studio generated code that you shouldn't edit anyway so it doesn't really make a difference because you're not editing same code in more than one place. You're still responsible for adding CRUD operations to the service yourself, so if the default generated code doesn't include an insert method then you simply add one yourself. Generally you'll end up adding lots of variations on insert, delete, and add service methods. And there's no black box here. All the generated code is part of your project.
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
So each version of Silverlight that comes out I take a look and see how the technology is progressing. I finally got to SL4. This may be user error but I'm really frustrated with the data access. I first tried POCO, using my own objects from the server. Got those passed through WCF and bound but then you can't use the DataAnnotations (I like the ID of having the validations for the data where the data lives in the class) when you bind on the client. Then I went to the WFC Data Service model using MVVM. Looked good but then guess what, same issue. Lastly I went to RIA but couldn't figure out how to add an object on the client. Evidently MS didn't build my Insert function on the Domain Service. So I went to go look for myself. So many generated functions with odd attributes my eyes hurt. I’ve looked at videos which all simply just edit objects but don’t add anything. But if they would I can get the DataAnnotations working with RIA but I have to do this kludgy Metadata object. So is there a better way or am I doing something wrong? I hate MS generated black boxes because they tend not to work for real applications and then when something does go bump in them you spend hours on google researching only to find out you are so in bed with them you have to wait till next release to get it fixed. I’m just about to create my own Data layer architecture for working with SL but before I do I thought I would do a sanity check with the guru’s. What did I miss? Is there a better way?
There never was a chance that we would use RIA, for the same reasons you iterate, black box, MS defined and constrained functionality etc. We built our own, first building a code generator (modified the existing one which began life in VB5) to service the WCF requirements. This is basically simple boilerplate code for the object and CRUD work. This pushes 90% of our work into the VM and View, where we have some really cool snippets that eliminate all the donkey work and leaves us with the difficult stuff like making the dammed view do as it is told! It is painful getting a design idea wrong, you should see the crap we (I) created around dialog management before I got a handle on the child window concept.
Never underestimate the power of human stupidity RAH