Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a class "Student", this class is used in ProjectA in solution1 and same class used in ProjectA in Solution2

I have changed something in Student classfrom solution1, that changes not reflected in solution2, still its holding the previous.

My problem is : How to share the project between 2 UI, when something changes from solution1 and that should be reflected in solution2, so how to maintain the single instance of Student class across different UI.


What I have tried:

I'm using dependency mechanism in prism but its working between the modules, but not between the solution and different UI
Posted
Updated 14-Nov-19 20:28pm
v2

1 solution

There are two ways to include a project in a solution:
1) You can add a reference to the Assembly to the new project. THis just gives the new project access to the classes in the added project.
2) You can add an existing project to a solution. This allows you to edit the code of the added project from either solution.


Neither of these will automatically "update" Solution1 or Solution2 if the added project is changed in the other - it requires a rebuild of both projects to use the new version.
And if you think about it, that's exactly what you want to happen.
Why? Let's look at what would happen if asn edit automatically updated both. Suppose it doesn't work immediately; it has a catastrophic bug? Both applications fail, despite one of them not "knowing" about any changes! That's bad: you shouldn't "break" existing code!

So add your project to both solutions, and then build both solutions when the "common project" is stable. That way, the "unaffected app" doesn't fail because the common project changed in the meantime.
 
Share this answer
 
Comments
sheik SHA 15-Nov-19 6:24am    
Thank you for you solution, currently we are using the same that you have mentioned.

Sorry i didnt explain my question clearly.

What i need: during compile time its fine, please consider the following scenario

Both applications are running
- initially student object contains Name property and the value is "XXXX"
- after running both application, solution 1 reading the Name property and the return value is "XXXX" also read from solution2 and return same "XXXX".
- Then solution1 change the name to "YYYY" and solution2 reading the name again, my expectation is the name should be "YYYY" but its return same "XXXX", which shows both application using same code during compile time but maintain 2 different instance on run time.
OriginalGriff 15-Nov-19 6:46am    
Right ... that is not going to happen. The two applications have totally separate memory, and what happens to one object in AppA does not, cannot, and will not affect an object in AppB, even if they share classes.

What you need is "intermediate storage" which holds the information that is used by both AppA and AppB: I'd suggest that you look at a DB, probably server based since you effectively need multiple users accessing it at the same time.
The other solution is to have the two apps communicate between themselves, but that's complicated and "locks" the two apps together - it's possible, but if you later add AppC it starts to get exponentially more complicated. A DB is a better solution here, really!
sheik SHA 15-Nov-19 6:54am    
Thanks for your reply and effort :)
OriginalGriff 15-Nov-19 6:55am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900