I am using RIA services in a silverlight application with a RIA domain service that does data transfer. I have made changes to the domain service and metadata in terms of updating methods, adding methods, putting data validation attributes on the metadata fields, etc.
When I am in the position where I need to re-generate the domain service due to adding a new table, obviously the generation algorithm doesn't preserve my metadata attributes or additional domain service methods. Is there any way to preserve this via Visual Studio? IS there a better way to address this situation?
Right now I copy the domain service and metadata files, regenerate the domain service and metadata then open the old files and copy my updates back. This is a PITA.
Use partial classes. You can create partials for your domain service like MyDomainService.cs and MyDomainService.metadata.cs.
for example, in the MyDomainService.metadata.cs
[MetadataTypeAttribute(typeof(Login.Login_Metadata))]
public partial class Login
{
internal sealed class Login_Metadata
{
public Login_Metadata()
{
}
[Display(Description = "Test")]
public string FirstName { get; set; }
}
}