asp.net mvc - Interface in Mvc Project, Implementing in Data Project - circular reference? -
i'm developing mvc application practice best practices (trying 'correct' way). more precise, thought of building mvc application ajax endpoints chat service.
i wanted have 1 little more flexible, thought of using interfaces
define structure of used objects. interfaces should implemented datalayer project.
now wanted define interfaces in mvc-project , put datalayer stuff in separate project. lead circular reference though, thought of bad practice.
what 'correct' way solve issue? approach reasonable?
some code show want archive:
mvc project:
public interface ichatuser { guid userid { get; } string name { get; } }
datalayer project (part of class):
public class user : ichatuser { private guid _userid; public guid userid { { return _userid; } } public string name { { return this.lastname + " ," + this.firstname; } } }
is there reason aren't using nhibernate? if controllers have access session object basic queries want run.
complex stuff gets broken out separate query or command objects.
we built full mvc app using stuff discussed here: http://ayende.com/blog/154081/limit-your-abstractions-you-only-get-six-to-a-dozen-in-the-entire-app , happy results.
Comments
Post a Comment