mazdotnet said:
Hi,
I've been doing web development for a long time using a single web
application file (Classes in App_Code folder). However, now I'm
starting a new web application and I want to break all the layers
into
different projects where at least Web Application is one project &
a
data access layer is another project.
It should be UI/BLL/DAL. The UI should not be in contact with the DAL.
If you want to come right down to it, the UI should not be in contact
with the BLL either.
My steps,
I create an application in IIS 'e.g., MyAppSite'. (I like to use IIS)
I create a new solution in VS2008 and add a class libary project
'DAL'
<- is this correct?
You're missing some layers.
I add thehttp://localhost/MyAppSiteto the solution
I change the output of my DAL to point tohttp://localhost/MyAppSite/Bin
and everything works fine.
My problem is debugging DAL project (I'm using LINQ to SQL). Is there
way for me to set break points in DAL project and see what the values
are? Without creating a unit test project for my .dbml file since it
has so many methods?
You don't test the database model. You test the classes/objects of the
DAL that act upon the database model.
Many call a functional test a unit test. They are two different types of
tests, which can be done with a test-harness.
A unit test is about the simulation of object behavior within the domain
for expected results with pre-written test cases against the domain --
Domain Driven Design and Test Driven Design.
A functional test is about testing functionality, whereas, testing
involves the database, filesystem, going across a network and special
configuration like a config file being used to perform the test.
I might want to add transactions later using
stored procedure and my own C# class..etc, I want to test the output
of the DAL (data access layer) to make sure it works (where I want to
set breakpoints if needed)
You can put the classes/objects in the DAL into a transactional mode
against the Linq-2-SQL model by using the System.Transaction. You don't
need spocs.
You need to find out how to use the ADO.NET Entity Framework an ORM
solution. You can start with Link-2-SQL but where you should position
yourself is using EF.
Can you please explain how I can do this? Am I taking the correct
approach by creating a Class Project for my data access layer or I
should be doing this differently?
UI
MVP or MVC
BLL
WCF
DAL
database Model
And yes, you can set breakpoints in each one of the layers and single
step all the way from the UI to the DAL.
You should get the book and get the DOFactory software and learn.
http://headfirstlabs.com/books/hfdp/
Dofactory is well worth the price if you're interested in how to
develop n-tiered solutions.
Head First is in the dofactory.
http://www.dofactory.com/Framework/Framework.aspx
I'll give you the rest of my little take on things, which a is needed to
develop solid .NET solutions, particularly Web and SOA solutions.
What is Object-oriented-programming?
(OOP) is a programming paradigm that uses "objects" and their
interactions to design applications and computer programs.
The key concepts of OOP are the following:
Class
Object
Instance
Method
Message passing
Inheritance
Abstraction
Encapsulation
Polymorphism
Decoupling
http://en.wikipedia.org/wiki/Object-oriented_programming
No matter what development platform Java, .Net or others OOP is OOP.
http://math.hws.edu/eck/cs124/downloads/OOP2_from_Univ_KwaZulu-Natal.pdf
http://www.blackwasp.co.uk/ObjectOrientedConcepts.aspx
What are design patterns?
Design patterns are recurring solutions to software design problems you
find again and again in real-world application development. Patterns are
about design and interaction of objects, as well as providing a
communication platform concerning elegant, reusable solutions to
commonly encountered programming challenges.
http://www.developer.com/design/article.php/1502691
http://www.dofactory.com/Patterns/Patterns.aspx
<
http://computerprogramming.suite101.com/article.cfm/patterns_and_anti...
http://msdn.microsoft.com/en-us/library/ms954638.aspx
http://www.designpatternsfor.net/Presentations.aspx?tid=3&cid=4
What is Domain Driven Design?
(DDD) is an approach to the design of software, based on the two
premises [1] that complex domain designs should be based on a model, and
that, for most software projects, the primary focus should be on the
domain and domain logic (as opposed to being the particular technology
used to implement the system).
http://en.wikipedia.org/wiki/Domain-driven_design
What is Test Driven Design?
(TDD) is a software development technique that uses short development
iterations based on pre-written test cases that define desired
improvements or new functions. Each iteration produces code necessary to
pass that iteration's tests. Finally, the programmer or team refactors
the code to accommodate changes. A key TDD concept is that preparing
tests before coding facilitates rapid feedback changes. Note that
test-driven development is a software design method, not merely a method
of testing.
http://en.wikipedia.org/wiki/Test-driven_development
http://weblogs.asp.net/rhurlbut/archive/2007/07/16/another-tdd-and-dd...
What is Model-View-Controller?
(MVC) is an architectural pattern used in software engineering.
Successful use of the pattern isolates business logic from user
interface considerations, resulting in an application where it is easier
to modify either the visual appearance of the application or the
underlying business rules without affecting the other. In MVC, the model
represents the information (the data) of the application; the view
corresponds to elements of the user interface such as text, checkbox
items, and so forth; and the controller manages the communication of
data and the business rules used to manipulate the data to and from the
model.
http://en.wikipedia.org/wiki/Model-view-controller
http://msdn.microsoft.com/en-us/library/ms978748.aspx
<
http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framewo...>
http://cristobal.baray.com/indiana/projects/mvc.html
http://www.devx.com/dotnet/Article/29992/0/page/1
What is Model-View-Presenter?
MVP is a software pattern considered a derivative of the
Model-view-controller.
http://en.wikipedia.org/wiki/Model_View_Presenter
http://msdn.microsoft.com/en-us/magazine/cc188690.aspx
http://mrrask.files.wordpress.com/2008/01/model-view-presenter.pdf
http://www.mvcsharp.org/Reworking_ASPNET_MVC_Store/Default.aspx
<
http://www.codeproject.com/KB/aspnet/ModelViewPresenter1.aspx?fid=153...>
<
http://codebetter.com/blogs/jeremy.miller/archive/2006/02/01/test-dri...>
MODEL-VIEW-PRESENTER
http://www.polymorphicpodcast.com/
click 'Shows'
click 'Design Patterns Bootcamp: Model View * Patterns*
view parts 1-5
What is Object Relational Mapping?
(ORM) is a programming technique for converting data between
incompatible type systems in relational databases and object-oriented
programming languages. This creates, in effect, a "virtual object
database," which can be used from within the programming language. There
are both free and commercial packages available that perform
object-relational mapping, although some programmers opt to create their
own ORM tools.
http://en.wikipedia.org/wiki/O-RM
http://www.objectmatter.com/vbsf/docs/maptool/ormapping.html
What is Language Integrated Query?
LINQ is a Microsoft .NET Framework component that adds native data
querying capabilities to .NET languages.
Microsoft LINQ defines a set of query operators that can be used to
query, project and filter data in arrays, enumerable classes, XML,
relational database, and third party data sources. While it allows any
data source to be queried, it requires that the data be encapsulated as
objects. So, if the data source does not natively store data as objects,
the data must be mapped to the object domain. Queries written using the
query operators are executed either by the LINQ query processing engine
or, via an extension mechanism, handed over to LINQ providers which
either implement a separate query processing engine or translate to a
different format to be executed on a separate data store (such as on a
database server as SQL queries). The results of a query are returned as
a collection of in-memory objects that can be enumerated using a
standard iterator function such as C#'s foreach.
Many of the concepts that LINQ has introduced were originally tested in
Microsoft's C? research project. LINQ was released as a part of .NET
Framework 3.5 on November 19, 2007.
http://en.wikipedia.org/wiki/Language_Integrated_Query
What is Linq-to-SQL?
LINQ to SQL, a component of Visual Studio Code Name "Orcas", provides a
run-time infrastructure for managing relational data as objects without
losing the ability to query. It does this by translating
language-integrated queries into SQL for execution by the database, and
then translating the tabular results back into objects you define. Your
application is then free to manipulate the objects while LINQ to SQL
stays in the background tracking your changes automatically.
http://msdn.microsoft.com/en-us/library/bb425822.aspx
What is ADO.NET Entities framework?
ADO.NET Entity Framework is an object-relational mapping (ORM) framework
for the .NET Framework. This framework is Microsoft's first ORM offering
for the .NET Framework. While Microsoft provided objects to manage the
Object-relational impedance mismatch (such as a DataSet).
ADO.NET Entity Framework is included with .NET Framework 3.5 Service
Pack 1 and Visual Studio 2008 Service Pack 1, released on ...
read more »