Where do the library classes go?
I have experience with Ruby on Rails and am currently programming a project in ASP.NET. So finding ASP.NET MVC was awesome for me as it looks like a literal copy of Ruby on Rails in many ways. However, there are differences and I have a lot to learn a thing or two.
One of those things is the way in which additional (library) functions are handled. I want to add the encryption utility function, and in Rails I would just add the class to the / lib directory and know that it will be available in my controllers. How do I do this in ASP.NET MVC?
I was thinking about creating a model class for this, but I'm not sure if this is the right way. All I really need is an encrypted (simple) and decrypted (encrypted) function that returns a string, I will be using the .NET libraries for encryption and decryption, but I want to encapsulate and proxy their functionality with easy to use, use functions. available on multiple controllers.
Any suggestions?
source to share
Asp.net MVC still has links, so add your libraries to the folder of your choice and link to that library via the add link option.
I like the following tree structure.
/docs /lib /src /tools
the lib folder is for third party libraries, src is the source for my mvc, and the tools are for tools like nunit, etc.
for your own libraries add a new project for them just like in normal asp.net. I would also like to add a new project for my model, bll and dal.
source to share
This may not be a direct answer to your question, but I have the following structure for an opensoure project that I am developing with asp.net mvc ..
* Gol.Core.Session (contains session manager both real and fake)
* Gol.Core.Caching (contains caching including velocity, enterprise lib. provider)
* Gol.Core.Logging (contains logging components and providers)
* Gol.Core.Instrumentation (contains instrumentation related items)
* Gol.Core.UI (UI helpers, and other things related to UI)
* Gol.Core.Security (security,authentication related things)
* Gol.Core.Utilities (common utility functions like encryption, helper methods, etc).
* Gol.Core.Metadata (metadata manager).
*
Gol.Web.Controllers (all controllers goes here).
*
Gol.Cms.Contracts (contains the service contracts)
* Gol.Cms.Model (contains the service model)
*
Gol.Cms.Services (contains the service implementation).
*
Gol.Web (the web project that contains the views)
* Gol.Test (or Gol.Specification)
This raises a related question regarding Recommended project structure for asp.net mvc
source to share