Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have written a windows form app in C#, but I want to turn it into native code for ASP.NET so I can build a webapp around it. However, I've never used ASP.NET and I'm not sure how to approach this. I've looked around and seen libraries such as VisualJS.Net, but it looks confusing and I'm not sure if I can seamlessly integrate it into my app without causing problems later on. Could someone lead me towards the right direction?
Thanks!
So if I well understand, you would like to "transform" a Windows Forms app into a ASP.NET. The problem with this approach, is that those two technologies are like day and night. They don't have the same lifecycle at all. Windows applications are by definition stateful. This means that they keep their state in memory and they don't need to rebuild it often (maybe at the loading of a file). Web applications however are completely stateless. The server receives a request, processes it and returns web content (HTML, JSON and whatever is needed). If the server is again contacted with new information, the state must be rebuilt (with the help of cookies, sessions, etc).*
However, what you can do the ease those problems is the following. If you separate your concerns, you can more easily reuse your business logic and your data and just re-code the view of your application. This means that you must separate what belongs to a View technology (WinForms, ASP.NET) from the model itself. There are numerous patterns to support this : MVC, MVP, MVVM. Respecting GRASP patterns also helps.
With that in mind, you could have three solutions : One containing your common code, one containing the logic that belongs to WinForms and another one that contains your ASP.NET logic. It's easier said than done, but this should be the way to go.
You can't turn an apple into an orange. Those two technologies are so different, that you will be better off rewriting the application from scratch, and taking advantage of all the goodies available in ASP.Net MVC 5.
Technically speaking one could devise some type of a converter, but it would potentially promote bad coding practices, something you should avoid.
Start learning MVC 5, you will be better off in the end.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I plan to make some applications that will let me organize tasks from home or from somewhere else. For this I need a database server (a virtual one running at home), a backend part (the business logic) and the front end (the view). At school we learned the MVVM via WPF, but to be frank I use it only when it is explicitely required.
There are a lot of benefits in favour of Unity like
Artist friendly
Can compile to mobile, web and desktop
Fast development (in my case at least)
Has a lot of built in features I can harness.
Now, even as simple as I will make an app like this, sometimes I might want to extend it, improve it or change some components entirely.
I know how to use MVVM in WPF but I only have some vague ideas for the Unity implementation which I would like someone skilled to overview.
The front end (Unity) would take care of sound management, fancy animations and the UI itself. But UI button events cannot access directly the database, so I thought of building some bridge classes. Say I want to delete a reminder, as an easy example. In an OnButtonClicked() method I would just call a BridgeClass's PleaseDeleteThis(MyReminder) and inside that method there's the backend solution that actually finds that reminder by id and removes from the database, then sends an everything all right flag back to the front end app so I know it was successful.
What I thought of is that using these bridge classes I wouldn't have to worry about what happens if I change the database server or the front end, as all they have to know is communicating with the bridge. I know the example was over simplified, but how doable would this one be regarding the component integrity and the MVVM pattern?
MVVM has been successfully used by AAA software houses to build games. The makers of Shipbreakers (aka Homeworld: Deserts of Kharak) wrote their code such that the View was a MonoBehavor I believe, VM and M were POCO classes written external to and independent to Unity so as to speed development. They can have their own Views for prototyping external to Unity.
They also wrote their own debugging visualisers and property editors for Unity.
https://www.youtube.com/watch?v=q9aeNtKKXeo
MVVM is about at the 19:18 mark though I do recommend to watch the whole thing as there are some other great things in there.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am trying to build a large application using ASP.NET MVC and entity frameworks. I know this project will become very large at some point so I want to make sure I design it in a way to be able to manage it without lots of unnecessary work specially when I have more programmers helping me down the road.
Another thing I like to consider is the application deployment. I don't want to have to keep compiling my application every time I make update or add new section to my application.
I believe using the MVC design will keep my code clean and easier to maintain. But one thing I really want to enforce is a module design to keep my files organized.
Based on some searching I have done, three things came up Areas, MEF and MAF which seems to be based off the same idea.
I also learned that MAF may be an over kill for most projects where MEF is more in the lines of what I may be looking for.
Most of the articles that I found are at least 2 years old and talks about ASP.NET MVC 4. I am not sure how relevant that is to ASP.NET MVC 5 or ASP.NET MVC 6.
What is confusing to me is that MEF is a framework and ASP.NET MVC is another framework. Is it possible to use the two frameworks to get an MVC design with module base application that allows me to organize my file and not to have to compile my application every time I need to make an update or add a new module?
Is the combination of MVC and MEF consider a good start for a large application? Is there a better idea that I should consider when designing my application?
I don't think MEF is the answer to what you're looking for. MEF was designed with the idea of giving to the developers the ability to create a "pluggable" architecture.
Imagine to develop an app whose core will be shared among different clients, but with some custom modules for some of them. Then MEF is what you're looking for.
Instead, from what you're saying, I think you're just trying to create a tidy and solid architecture, easy to maintain in the future. You don't need MEF for that.
Here is a good article about how to structure big MVC applications keeping in mind the principle of separation of concerns: https://chsakell.com/2015/02/15/asp-net-mvc-solution-architecture-best-practices/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I want to build websites in a modular fashion, so I can get better code reuse and abstract away some implementation details. I'm looking for advice on how to code such a website with ASP.NET and Visual Studio, and modules for such a website, because at the moment my websites don't have this nice property.
At the moment I'm working on a web-app that's providing a pretty straight-forward internally facing contact manager for a company. We plan on using identical contact managers (pointing to different databases) for each of our independent customer-facing websites (each for one of the company's businesses). I'm using ASP.NET MVC in C# with EntityFramework. What I'd like, is to be able to simply drop this contact manager package/project/class-library into a Visual Studio solution for an ASP.NET MVC Website, and then just add whatever 'wiring' I need to get them working together. I've seen the use of "areas" within MVC apps, that basically function as mini MVC applications, but it's been messy and actually less maintainable because of configs and different areas wanting different versions of assemblies (this is not code I wrote, and I want to avoid writing code like this). I have an idea of what this would look like in terms of data-objects and box&line diagrams; unfortunately, I don't know what this looks like in terms of views, controllers, projects, or assemblies.
The thing is, as a relatively unseasoned programmer, I've never done this before, so need advice on how to proceed. I'm unfamiliar with the patterns/idioms I need to implement this. So while I have the theoretical knowledge of how to write nice modular software architectures, I don't know they end up looking like in-terms of their actual classes, namespaces, and Visual Studio Projects/Solutions.
My question is, how do I build a website that's more modular than your standard MVC? And, if you have experience doing this (or attempting to), could you please share it? Or even better, can you offer a concrete example of such an architecture? (note this will probably require a link to something not on stack overflow, since you can't copy and paste an entire code-base to stackoverflow).
Apologies for not having a specific question, but this is a bit more complicated than a simple query of "how to traverse a b-tree", "why isn't my code compiling", "does anyone have a regex to do the thing I want", "I wrote some terrible code and now it broke", and "I haven't read the documentation (assuming there is any) and now I'm getting an exception that I don't understand". There likely isn't a single answer, because programming is complicated, solving real-world problems takes thought, and writing good code can be hard. Also, I can't exactly post the code I'm working with because of this thing in my contract known as a confidentiality clause, and not that anyone would read through 100's of thousands of lines of code and tell me how to make it better. \end_rant
I think you are looking for the "Onion Architecture".
Here's a live implementation of the Onion Architecture over on GitHub that uses Web API, MVC etc. It uses the all familiar Northwind database. So you can browse through the code and solution after you learn about this architecture and make sense of it and incorporate the parts you need in your project / solution.
Also, here's a nice tutorial on how to develop using this approach.
Finally, a Channel 9 Video that was what I originally found a few years back when I was researching the same thing, and found it very useful.
ASP.NET MVC Solution Best Practices
This video also takes an existing monolithic project and turns it into an Onion Architecture implementation, along with reasoning on why we are doing what at every step.
First of all you have to direct yourself in implementing your systems based on an approach that can provide complex systems that will not make everyone furious in waiting.
This is commonly known as the Domain-Driven design.
Then comes SOLID. SOLID represents architectural choices that will make your system easy to maintain and extend.
See SOLID in action using C#
All these along with Patterns of Enterprise Application Architecture can keep you busy for all your career and yet it could not be enough.
trying to follow the above in your programming will give you eventually a "less-monolithic" system and modular.
In ASP.NET MVC terms the above could mean:
Keep the MVC paradigm. Do not feed your controllers more than they should eat. Keep them only for what they are. Traffic cops. Also do not put logic in your views in order to keep them abstracted.
Maintain your logic in a separate "space". By the word "space" i mean a separate project, solution, assembly....whatever you think fits to your application size that you are building.
Use MVC Areas for what they are supposed to be. They fit perfectly for the FrontEnd / Admin case. You want to have a frontend that looks and operates differently from the backend, but obeys some general system rules.
Use Web API to make your application open and expendable. This will bring Javascript into play which itself needs to be addressed regarding SOLID e.t.c..
Do not overdose your application with javascript frameworks just for the shake of it. Use what you really need.
Use IoC container like Ninject to manage your dependencies..Marry your interfaces and let IoC resolve your implementations
If you going deep in javascript , take your time to define your viewmodels correctly. They are the contracts between 2 different worlds so they must be clear.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm not sure if I'm going to be able to explain it right since I'm quite sure I don't know the correct terminology involved with it, which is also why I'm having a difficult time Googling for answers.
Essentially, I'm looking to develop a program that serves as a web site. It'll run constantly (like a service) and will return HTML when an outside user sends an HTTP request thru a browser or similar to a specific port on the computer this program runs on. Basically, this program will perform various background errands throughout the day but I want to be able to expose a web front end (almost like how you would with standard WinForms, but I want to be able to access it remotely) to be able to configure it, check the status of tasks, and otherwise interact with it.
I'm looking to use .Net, but I'm open to using something more universal like Java too. Someone with experience in this area would be helpful to explain any pain points you've encountered and suggestions on how to get started.
You can do it in C# with the HttpListener class.
I published an example some time back. See A Simple Http Server.
Although you might consider whether you really want to operate at that low level. I have written a fairly complex server based on HttpListener, and if I had it to do over again I'd probably just bite the bullet and use ASP.NET. There is a bit of a learning curve, but unless your server is incredibly small and simple, an ASP.NET application will be a lot easier to write and will likely be more robust.
Here is a simple example on how to do it in C# using the HttpServer class:
http://www.codeproject.com/Articles/137979/Simple-HTTP-Server-in-C
You are doing at least 2 different things, so you should probably create a Solution in Visual Studio.NET with one project for each purpose (You can have many projects in a solution), probably with at least one Data Access project as well (of type Class Library). If the solution does things at certain times of the day, then those can be Console Applications that run through task scheduler, rather than one of more services. Services are better suited to things other than simple scheduled tasks. A Web Application project can serve up your html.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm about to do a project on financial data visualization. Nothing advanced really, just some user input manipulated and visualized as an output with some charts and numbers. The thing is though, that even though the plan is to have it as a .NET desktop application to begin with an idea is to later transform it into a web based application. And since I've got no experience with that whatsoever my question is simply: Can one write a desktop application in C# .NET and later "upload" or "convert" it into a web based interface without too much work?
I've heard of ASP.NET that seems to be a pretty well used framework for web applications, but I cannot find anything about converting a desktop application into ASP.NET application.
Thanks in advance!
IF you divide your application into parts as you should - e.g. business logic, data access layer etc (into different dlls preferably), then all you need to do is just create a new UI, which isn't as bad as creating the app from scratch...
There is obviously a confusion in definitions. You (and it seems some of the guys that posted their answers here) have probably misunderstood the technology.
You can't compare ASP.NET to C#, because one is a web framework, the other is a programming language. ASP.NET can and does use C# (or VB.NET or other .NET language). ASP.NET can then be divided to MVC and Webforms. If you want to compare it to something, you should compare it to windows frameworks like WPF and Winforms.
That said, if the two apps have the same functionality, the logic and the C# stays basically the same. The only thing that changes is the framework that's used for the UI. That's why I'm talking about dividing the app into subprojects, which you can then reuse as needed.
As far as I got your question, there is no way to convert a .Net Desktop Application to a web application. you will need to re-write it. sorry buddy.
Unfortunately not.
When you start developing your Application for Desktop (for example with Windows Forms) the differences to a Web Application are too big too automatically convert.
I suggest to make a web Application from the beginning.
MfG Mike
I think there are service/companies/utilities that do do that, but you don't hear a lot about them, prob because they are not great. I don't know of other technology families that do that better either.
If the eventual goal is a website, prob just start with the website and forget the desktop. Slower to develop and more to be aware about to be secure are the other downsides.
the downvotes are prob about the question already being asked. If you google "stackoverflow: C# desktop to website conversion", here are three posts that are similar, in descending order of informativeness.
Converting ASP.NET Web Forms application into Desktop Application
Can I convert from C# to asp.Net to host application online?
How to Convert C# Desktop Application Project to website