WCF RIA 代码共享
To share a source file by using file links
1. In the middle-tier project, add a new code file.
2. Add code to the code file.
3. In the presentation-tier project, right-click the project, select Add and then select Existing Item.
4. Select the code file that you added to the middle tier project.
5. On the Add button, click the down array and select Add As Link.
When you compile the project, you will see that the file has not been copied to the client project. Instead, a reference was added to the file。
重要的是要在表示层里面放一个文件夹名字为SharedCode只有是这名字才能被想识别。在这个文件夹里面添加一些类文件就可以,选择中间层进行刷新就可以看见在中间层里面多了一个文件夹它的名字为Shared_Code里面有一个同名类文件。类名要为*.Shared.cs,即要有.Shared才能被识别。

浙公网安备 33010602011771号