What is the difference between .shared, .metadata and .partial files in Silverlight RIA applications?

I saw these 3 types of files, although not in one application. What are they, what is the difference between them, and are there any other extensions you need to know about?

+4
source share
1 answer

I will try to clarify this a bit.

A code file with the extension .shared gets "copied" to the silverlight client project at compile time. So you can manage the server side code, but use the same client side code. Here you can find the definition of the SharedCode function in silverlight.

A code file with the extension .metadata strong> is usually generated by the "New Domain Service Class" class in Visual Studio when you check the "Generate related classes for metadata" option. This file contains additional information about class metadata, such as ValidationAttributes for the silverlight client. Here you can find metadata information in the WCF RIA services.

Code files with the extension .partial only signal that this file contains additional partial code (implementation of partial methods, additional methods or properties) for the class. This is usually used when you extend a class that is autogenerated by a developer (e.g. Entity Framework).

The only really special extension is .shared , because these files are especially suitable for compilation. All other extensions are just designations for files to signal which code is inside the file.

Sidenote: What I am doing now is that when I implement the class interface, I define the class as partial and put the interface implementation code in another code file with the interface name as the extension.

Example:

UserListViewModel.cs -> partial UserListViewModel class with viewmodel implementation

UserListViewModel.INavigationAware.cs -> partial class UserListViewModel with implementation of the INavigationAware interface for the view model.

+4
source

All Articles