c# - Assembly, Namespace, DAL; What classes belongs where? -
i understand few basics assemblies , namespaces. i've reproduced nhibernate tutorial, , works fine. i'm not sure if agree on classes go where. @ solution explorer image attached..
domain , repositories (with classes in folders) namespaces. , here both in ...dal assembly.
- is there logical reason put there? product poco class. shouldn't more naturally belong outside dal assembly?
- is correct put iproductrepository in domain namespace? , if suggest move poco classes, move iproductrepository?
- what need if wanted make dal usable both c# , vb.net projects?
is there logical reason put there? product poco class. shouldn't more naturally belong outside dal assembly?
the argument putting poco class in persistence implementation simplify deployment , reduce total number of needed assemblies.
that not agree practice.
it better practice, , perhaps more conventional, place definitions of domain objects in 1 assembly, , implementations depend on persistence technology in another.
clients can reference assembly of domain object definitions without being tied implementation strategy.
is correct put iproductrepository in domain namespace? , if suggest move poco classes, move iproductrepository?
yes, correct definition of repository in domain.
repositories domain concept, not generic - @ least not interface expose (the implementations may in fact generic).
the interfaces repository should live definitions entities (whether poco's or interfaces) , other domain objects.
what need if wanted make dal usable both c# , vb.net projects?
nothing special. can reference assembly either c# or vb.net, whether dal and/or domain assemblies written in c# or vb.net. large advantage of .net whole , quite intentional , design.
Comments
Post a Comment