Is It Possible with CSLA?

Is It Possible with CSLA?

Old forum URL: forums.lhotka.net/forums/t/2938.aspx


SimpleCSLA posted on Wednesday, May 23, 2007

I just received my Expert VB 2005 Business Objects book yesterday.  After downloading CSLA Project Tracker and continuously getting a DataPortal.Fetch error, then reading dozens of such problems on this web site, I (we) have literally wasted 2 full days trying to get the program running. 

So here's my question - is this framework worth the hassle?  I'm being 100% serious - do you guys really read the entire book before trying to install the sample web or did it just work when you installed it?  We've got 15 programmers here and three of us are trying to figure out why we keep getting DataPortal.Fetch errors.  We've installed the EnterpriseServicesHostvb.dll, but it seems that the dozens of errors people have received have numerous possible solutions.

The other 12 programmers are just snickering saying "We told you CSLA was too complicated?", but I can't imagine it is.  There has too be something dumb I'm missing.  I've gone through Chapter 12, but everything seems fine.

If its of any help I think the section in the web.config <add key="CslaAuthentication" value="CSLA"/>, has something to do with the problem.  It keeps returning the IDENTITY.IsAuthorized=False,  but I can't figure out why.  Changing the value to "Windows" only gives me an error on the line "Return svc.Fetch(objectType, criteria, context)" in EnterpriseServicesProxy.vb.

Sorry for my EXTREME frustration.

Michael Hildner replied on Wednesday, May 23, 2007

Did you check out the InnerException of your DataPortalException? That will give you some details.

Brian Criswell replied on Wednesday, May 23, 2007

First, hands down CSLA is worth the hassle.  End of story.

Second, there are a few things you should be aware of:
Third, a few of the benefits:
Your specific problem could be many things from a missing option in a config file to missing permissions in the database.  The exception thrown has a BusinessException property on it that will tell you what exception occured within the DataPortal.  When you get that exception, if you cannot figure it out yourself, post it on the boards here and someone should be able to quickly help you out.

Also, if you have any other questions about the framework, ask them and we will answer.

Also, what version of the framework are you using?

xal replied on Wednesday, May 23, 2007

So, I gather you're trying to run the Project tracker. I see that you're having trouble with the enterprise services host. Do you really intend to use Enterprise Services?
If the answer is no, then take a look at the app.config and comment out the enterprise services part.
Enterprise services can be a pain to configure, but if you just want to get familiarized with the framework, you don't really need enterprise services or remoting.
In that case, comment out anything in the web config that defines a dataportal proxy and a dataportal url. Just having the connection strings in the app config will have csla use a simple portal that connects directly to the db.

Once you're comfortable with csla you can test other setups like remoting, which is the most common for client server setups.

I hope that helps.

Andrés


PS: Yes, it's is really worth it. (but I'm biased) :D
PPS: Also, once you're more comfortable with csla, you can take a look at this.

xal replied on Wednesday, May 23, 2007

Also, here's a guide to setting up the project tracker:
http://www.lhotka.net/files/csla20/BuildCsla.pdf

Andrés

SimpleCSLA replied on Thursday, May 24, 2007

The error I keep receiving is:

DataPortal.Fetch failed (System.NullReferenceException: Object reference not set to an instance of an object.at ProjectTracker.Library.Database.get_SecurityConnection() in
C:\CSLA_214\csla20vb\ProjectTracker20vb\ProjectTracker.Library\Database.vb:line 13 at ProjectTracker.Library.Security.PTIdentity.DataPortal_Fetch(Criteria criteria) in
C:\CSLA_214\csla20vb\ProjectTracker20vb\ProjectTracker.Library\Security\PTIdentity.vb:line 110)

I put a break point on Line 13 in the Database.vb class, but it never stops. 

I've read through Chapter 4 where Lhotka recommends using the LocalProxy, but I don't know on his Project Tracker program where to set it to use LocalProxy (maybe it already is).

ajj3085 replied on Thursday, May 24, 2007

Are you trying the WinForms application or the asp.net one?  If its WinForms, check the App.Config file.  Otherwise, check the Web.config file.

there are a few things to look for in those files.  One would be anything DataPortal settings Andres (Xal) has already discussed.  The other is the database connection strings.  I THINK that Rocky has things setup for Sql Server Express, where you specify a file path to the .mdb file and SSE will create a User Instance.  Basicaly an instance that only exists for the user while the app is running.

If you're not on Sql Express, you should 1) Attach the mdb file to your running Sql Server instance and 2) change the connection strings appropriately.

Note that there are TWO databases; a Security database and a PTracker database.  You'll need to attach and change the connection strings for BOTH to get the sample working.

HTH
Andy

dlambert replied on Thursday, May 24, 2007

Any time you build an application from scratch, it's easier to start with "Hello, world", and build only what you need when you need it.  That will last until the application reaches a size where the complexity you've built starts to become your own worst enemy. 

At that point, if you examine what you've built, you'll begin to realize that the stuff you've constructed covers a portion of the functionality in a framework like CSLA, only it doesn't work quite right.  I can say this with some confidence because I've found myself in this position a couple of times. 

The real value of this kind of framework comes over the course of a project when you'd normally reach inflection points where things break for no apparent reason and massive hunks of the system must then be refactored.  That's less likely in a framework-built application because the structure of the framework helps channel development in "healthy" directions.

You can also see value in a framework like this when it's used across multiple applications in an enterprise becuase the learning curve for a new developer is compressed.  Learn one framework, and you're well on your way to understanding multiple systems.  Based on your original post, I think this could be the case for you.

Just a word of caution:  If you're facing a room filled with nay-sayers, you could be in for a tough battle.  That sort of mob mentality has a way of latching onto any excuse, real or imagined, in order to get its way.  Keep an  eye on the political aspects of this evaluation in addition to the factual aspects.

SimpleCSLA replied on Thursday, May 24, 2007

Thanks for the help.  In another thread Rocky gave me some tips and I turned off EnterpriseServicesVB.dll, and ran the data locally via my own SQL 2005 dbase.

I am now in a position to write some basic code and argue for using CSLA (assuming I like it, which I probably will).  Later I can attempt to get remoting to work, but for now all is well.

For those who care, the solution was to comment out the EnterpriseServices call in web.config.  Once that is gone, Database.vb looks at the connection string.  Once the connection string is right, it works.  I couldn't get this to work with SQLExpress, but 2005 caused no issues.

Thanks again.  

DansDreams replied on Thursday, May 24, 2007

All frameworks are complicated inside by definition.   The only way they provide value is hiding the complication. 

That's true of the .NET framework as well, of course.  Who wants to go back to manipulating strings the C++ way?!  You could argue it was decidedly "simpler", but it was way more difficult overall in the long run.

I've found that a new developer can be productive working on my enterprise application with almost zero understanding of CSLA.  In fact, they can use copy and search/replace and create a new fully-functional robust business object in short order.

Precisely the point of the framework in the first place, IMO.  It's why there is an Enterprise Library from Microsoft.

So, yes, you could do that too, starting with the ProjectTracker sample application.  No, you don't really have to read the book to use CSLA.  But somebody in your organization with the architect role/responsibility should.  Many people that start pushing CSLA end up wanting to change or add behavior, and you do need some level of understanding for that, of course.

Copyright (c) Marimer LLC