开发者

Tips/Resources on Structuring Shared Code Libraries in C#/WPF?

开发者 https://www.devze.com 2023-01-31 07:47 出处:网络
I\'ve written a simple desktop application with C#/WPF and I\'m now looking to create another, larger application which will share much of the functionality. I\'m thinking that I should create three s

I've written a simple desktop application with C#/WPF and I'm now looking to create another, larger application which will share much of the functionality. I'm thinking that I should create three separate projects: one containing the shared code, and one each for the开发者_JAVA百科 two apps.

My problem is that I'm not entirely familiar with .NET/WPF so I don't know if there are some best practices for this sort of thing. Can anyone offer some good sources of information, example projects or just some brief advice?

Edit: To put a little more detail on the scenario, the first application is a specialised editor and the second application is taking this file editor and wrapping a project model around it to create a sort of basic IDE.


Honestly it depends on what level the code you intend to share is. For instance, it's entirely plausable to put all of your business logic code into one project/class library and maintain it independantly, but mixing biz logic with WPF custom controls should be STRONGLY discouraged. Think about the layers of abstraction you are modularizing, and the dependancy heiarchy you are introducing and refactor accordingly.

Edit:

In response to your above changes I suggest the following: The logic and DAL associated with the above should be pushed into a project as seperate namespaces. The visual elements (the view, viewmodel) should most likely be moved into a seperate project and namespace set as well. Once you can merge these together and launch them from an exe that contains a host window and a UserControl for the rest of your hosted visual content, you can then probably move forward with integration into your larger IDE project. The key here is:

Visual Layer and View Logic -> Editor.Visual.dll

Biz Logic & Data Access -> Editor.Core.dll

I hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消