Structuring an MVC project [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I find the way of "having controller/view in same project, all model in separate class library" not intuitive to me. I prefer to have it vertically, i.e. having related controllers/views/view model in separate projects.
So I look up the internet and find that some (not many) people are using the area feature, but I find it a pain when it comes to do routing.
So why can't I put controller/views/view models as separate projects instead of area? Am I not able to do that or does that decrease performance so nobody uses it?

You can structure the solution however you want. Everything is configurable to work the way you want. Furthermore, the way you structure your solution should have no effect on performance.
It's going to be much more straightforward to structure the solution the idiomatic, default way. Other users of MVC are already familiar with the default way, which makes for easy collaboration. Even if you feel another structure is better - even if it is better - you're still going to greatly benefit from tolerating the default structure.

You actually can move the views model and controllers to the other projects.
It is not something available out of the box.
You would need to create your own implementation of few MVC infrastructure classes like: ViewEngine, controller factory and etc. I wouldn't recommend going this way as you would have really hard time migrating your project to new versions of ASP.NET MVC and the classes which Microsoft supplies are well tested and optimized.

Related

Best practice to integrate existing MSSQL db into Umbraco? [closed]

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
This is a general Umbraco architectural question, not a specific-to-the-line-of-code-question.
I am new to Umbraco but know my way around .net and asp.net mvc well.
For an upcoming project I am considering using Umbraco as a cms but as my experience with Umbraco is little, I cannot quite oversee what my options are when it comes to integrating an already existing mssql database.
The database that will support the Umbraco installation already has some tables present, containing product information. What is the best way to expose this data using the Umbraco api/models and subsequently integrate this data in Umbraco views?
E.g. can I create data models in the Umbraco admin and map those to the existing tables or is there another way that is considered to be a best practice?
Thank you.
I don't have a lot of first hand experience with this subject but I recently did an Umbraco bootcamp that covers exactly this, it's called "Umbraco Application Integration".
The course talks about Route Hijacking and contentfinders for mapping the external data into the umbraco request pipeline.
To call the external tables from you code, you can look into Umbraco's integrated lightweight orm called peta poco, but with a little work Entity Framework or nHibernate can also work.
To intergrate the external tables into you umbraco backend, there's a plugin called ui-o-matic that could help you out
Hopefully this puts you on the right track :)

Add/create modular architecture in ASP.NET 5 MVC 6 [closed]

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 4 years ago.
Improve this question
I want to create a modular architecture in MVC 6, with several interchangeable modules. Mostly for separation of concerns on grand scale, some modules will be "base modules" (always included). But all should have the same level of decoupling. Now that we have DI and IOC builtin the architecture of this might differ vastly.
I have looked around all over SO and only found MVC 4/5 and MEF solutions, but seeing as the new Startup.cs has changed considerably, and added new methods and best practices, i was wondering if there was a new way to do this.
I did however find the aspnet/Entropy project on GitHub, and they have Mvc.Modules package, which might do the trick although this might not be an official thing anytime soon.
EDIT:
It seems that the Mvc.Modules mentioned above isn't completely separated yet (controllers specifically), so it only half does the job.
Since MVC 6 is currently under development, it might be a better idea to look at the source code (especially the tests) to find features that you want to use when you cannot locate what you need on the Internet.
MVC 6 has support for DI of both Controllers and Views. Here are the tests for Controllers and Views.

Moving to next project version [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm starting on the second version of a large Solution/Project that I created and was wondering about the best way to go about it. I'll be changing allot of the core code, classes and projects of the solution and that makes want to make this into a separate solution and separate repository.
I've never really started on a version 2 before, so if anybody could give me advice on the best way to go about it I would truly appreciate it.
For the record I am coding in C# and using VS2012.
Thank You
Create a Branch in the repository called Version2 or something (maybe a better code name) and do all the new dev work in that. That way you still have the original Trunk if you need to go back to it. Maybe also create a Tag with the current project that will never change so you basically take a snapshot of it before making any substantial changes.
I usually keep everything in one solution and just evolve the solution. There are several benefits to this:
You refactor your tests along with the project (hope you do have some!)
Keep a tracked version of all the changes in your source control
It's easier to make sure your project is still stable after the refactoring by running test suits or running the executables in debug mode
It is safer to refactor little bits and peaces, than a global re-write, there is a risk you will go a little bit to far with refactoring

breaking up a monolithic project [closed]

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 am about to break a monolithic WPF/C# application into manageable modules. Please let me know what are the points i need to remember before breaking the software. Any tools that would be handy,etc.
Thanks in advance.
Regards,
JOhn.
Depending on your tool set there are a couple of things which generally help when analyzing a code base from an architectural or structural viewpoint.
In VS 2010 Ultimate or with a tool like nDepend you can generate dependency graphs which help you see you application's dependencies and code usage can be useful when trying to break large code into smaller api's or services.
Also unit tests and integration tests can help ensure that functionality is maintained without introducing bugs and using refactoring tools like resharper, justCode or coderush can really help to adjust your namespaces, code file physical locations and class/method signatures when dealing with a large codebases into smaller more manageable libraries and projects.
On the planning side you really need to establish the key elements of the application from a separation of concerns point of view to define the boundaries of each module.
Probably the worst thing you can do though is just launch in and start hacking the code into chunks. Mapping out a phased migration for one module at a time would be my strategy of choice.
Agree with the above comment though that the question is too broad to get any meaningful answers.
Your question is very broad as there are many techniques (e.g. heavily unit testing your code) that are of help. It is probably best to read a book on that topic. I can highly recommend you Michael C. Feathers
Working Effectively with Legacy Code
Although this book is mostly Java-centric the described techniques are generally applicable. It will definitely change the way you write and think about code and will be of help when working with existing applications.
Feathers' book is also one of the books that are most recommended in this SO post.
To complete Mac answer on tooling such as NDepend (Disclaimer: I am a developer of the tool NDepend) I'd advise to read these 2 white books on how to partition your code in assemblies, layers and components. This is certainly the key to break your monolithic code base.
Partitioning code base through .NET assemblies and Visual Studio projects (8 pages)
Defining .NET Components with Namespaces (7 pages)

How can I improve my first OSS project [closed]

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 7 years ago.
Improve this question
I am still visiting school and will finish my exams next year. Since two years I am working as (the only :-( ) in-house dev for a company providing financial services to Laboratories and doctors. After spending the first year fixing their existing Application and realizing, communicating and agreeing that it won't meet future requirements i rewrote it from scratch. This is my first LOB application.
I needed a "IEnumerable.ToDataTable()" method to do simplify certain things in the Application. I realized that existing solutions wouldn't meet my performance and flexibility requirements, so i came up with a solution based on Dynamically injected IL code myself.
I thought that this might be a good way to contribute to the community, thats why i asked my employer if i may take some of those code and release it under LGPL. They agreed and that's where my first project is:
ModelShredder
Since this is my first OSS project and i am relatively unexperienced with running an OSS project on my own I am asking you for some "best-pratices" and what i can improve on it.
First read this book:
You can download it free of charge here: http://producingoss.com/ There are also some nice screencasts there that may be some use too.
It covers everything you need to know about looking for, contributing to, starting and maintaining an open source project,
It all depends on if you're going to have a team help you or not. It'll be simpler to start doing it yourself if you have the time if for no other reason than you can work out how you want to proceed without worrying about politics.
For a start, any code used as a framework or a library typically needs to be developed to a much higher standard than what you might write for an internal application. This means you need:
Sufficient user and developer docuemtnation;
Unit tests with decent coverage;
A license;
Tagged versions in source control; and
Released binaries and source code with checksums.
Additionally you'll need a method of:
Communicating your project status (release notes, goals, etc); and
A means to allow people to raise and track issues.
Google Code (as just one example) can do pretty much all of this for you.
I would also suggest you register the domain name for your project (typically projectname.org for open source). If the one you want is taken already, you may want to change the project name, particularly as there might be cause for confusion.
The google code pages look pretty good to me. You might want to think about adding a support group on Google Groups.

Categories

Resources