Step by Step Guide?
Old forum URL: forums.lhotka.net/forums/t/2706.aspx
FCazabon posted on Monday, April 16, 2007
Hi,
has anyone done a step by step guide on how to create a new solution using CSLA?
I've been going through the book and it all makes sense in theory, but now that I am trying to create a simple application (just one table with two fields to update) I am at a loss where to start.
Part of my problem is that I am also just getting familiar with VS 2005 and VB .Net (or is it VB 2005?)
glenntoy replied on Monday, April 16, 2007
I hope this will help,
- Download, Extract and Compile the source code as a release version so that you will have Csla.dll
- There is a templates folder in the zip file when you download it. This will help you on creating the business objects. Of course you need to reference the compiled Csla.dll in #1.
- You can also go to www.onelittlevictory.com for online examples
FCazabon replied on Monday, April 16, 2007
Hi glenntoy,
thanks, I have the basic idea as you detailed it, but I was hoping something along the lines of this might be out there already (I'm slowly putting this together so it's in a very draft state right now:
Creating a new CSLA project:
- In
Visual Studio, select New | Project and then select Other Project Types
and Visual Studio Solutions
- Enter
Name of project (eg Membership) and click on OK
- Right
click on the Solution in the Explorer and choose Add | New project
- Choose
Visual Basic (or Visual C#) and choose Class Library
- Enter
the name of the library (eg Membership.Library) and click on OK
- From
the File menu choose Add | New project
- Choose
Visual Basic (or Visual C#) and choose Windows Application
- Enter
the name (eg Membership.Windows) and click on OK
- We
might need to add a Data project as well?
- Create
a database.vb (see file in ProjectTracker.library)
- Make sure
the References include csla.dll, system, system.configuration,
system.data, system.transactions, system.xml in the <projectname>.Library
project.
- Ensure
the references in the .Windows project include csla.dll, enterpriseserviceshostvb,
<projectname>.library.dll, system, system.configuration,
system.data, system.transactions, system.xml
glenntoy replied on Monday, April 16, 2007
If you are using Csla authentication or table based security you might want to include on creating a new csla class project for Security (like in ProjectTracker.Library under Security folder). If you do already have then just reference the existing project. I'm not quite sure if that is what you meant in #5
In #09, this is case to case basis, what if you already have an existing database in a development server?
#12. I think you can skip enterpriseservicehostvb if your not using enterprise services.
#13. configuration in application config (eg. client-server, .NET remoting, enterprise services)
Maybe you also need to include on how you organize your business objects using namespaces.
FCazabon replied on Tuesday, April 17, 2007
Thanks, I haven't got as far as even thinking about the security side of things yet, but I'll add that in.
My #5 point was just trying to define a naming convention for the Business Object library, so in my example, I would call the new project for the business objects "Membership.library".
Point 9 was with reference to the CSLA sample project having a PTData project, I haven't grokked the purpose of this project yet, so it was a reminder to myself to dig into it some more.
Thanks for explaining the enterpriseservicehostvb reference and the suggestion for step 13.
The purpose of this step by step guide is to help me follow the same steps when creating a new project (I tend to develop lots of different applications and won't be working in .NET and CSLA all the time so I need guidlines like this to get my brain back into gear).
FCazabon replied on Tuesday, April 17, 2007
Hi again,
your reference to the templates has led me to investigate them some more. How do I use these in starting a new project (please forgive me as I am pretty new to Visual Studio and .NET in general)?
Do I just copy the files from the template directory into a new directory and then go from there?
glenntoy replied on Tuesday, April 17, 2007
At first I used to cut and paste and just change the class name. But then I felt that it was time consuming to do it everytime (search and replace) I create a business object.
So what I did, is to explore on creating code snippets in VB.NET (
http://msdn2.microsoft.com/en-us/vbasic/ms789085.aspx). To give you a little idea on creating code snippets you can visit on this screencast (
http://channel9.msdn.com/Showpost.aspx?postid=295242).
Now, if you have CodeSmith code generator, I think you can download the code generators for CSLA in CSLA Contrib. I don't know if it does have VB.NET version.
FCazabon replied on Wednesday, April 18, 2007
Thanks for that.
I have been using CSLAGen to generate code, but found that I wasn't understanding the underlying code enough so went back to basics which has helped somewhat. As soon as I'm comfortable with the basics I'll look at using the code snippets and generators.
Copyright (c) Marimer LLC