project.DalLinq reference not showing up properly in project.library business objects.

project.DalLinq reference not showing up properly in project.library business objects.

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


nhwilly posted on Wednesday, June 24, 2009

This is a creampuff question floating across home plate - will some please take a swing at it?  Many thanks in advance.

An introduction:
 
1. I'm new to csla.
  2. I'm 55 and been out of coding for too long (too many children)
  3. I've purchased and read the last 3 of Rocky's books and bought two online titles.
  4. After several false starts, I am finally getting a few hours to actually build an app.
  5. I've got a serious ADHD-driven reading problem.

All true.

I've followed the sample code for a WinForms project, using the DataPortal_XYZ methods.  I've built a terribly simple, two field, disposable application to make sure I understand how things work.

I've got it working - Rocky and friends are complete geniuses and should be prohibited from selling books to people like me - but for one quirk that I don't understand.

My business object DataPortal_XYZ methods can't seem to handle a complete reference to the project.DalLinq.

I've referenced my dallinq to my library just like he says in the book.  But...

In the sample, his code looks like this:
<Transactional(TransactionalTypes.TransactionScope)> _
Protected Overrides Sub DataPortal_Insert()
Using ctx = ContextManager(Of ProjectTracker.DalLinq.PTrackerDataContext).GetManager(ProjectTracker.DalLinq.Database.PTracker)

In my code, it looks like this:
Transactional(TransactionalTypes.TransactionScope)> _ Protected Overrides Sub DataPortal_Insert()
Using ctx = ContextManager(Of DalLinq.ScoreBoardDataContext).GetManager(DalLinq.Database.ScoreBoard)

I've named my DalLinq as "ScoreBoard.DalLinq".  I can't put the "ScoreBoard" in front of DalLinq as then intellisense only shows me "Library" as a selectable option. 

The root namespace in "ScoreBoard.Library" is ScoreBoard.Library. 
The root namespace in "ScoreBoard.DalLinq" is ScoreBoard.DalLinq

There's a reference in "ScoreBoard.Library" to "ScoreBoard.DalLinq".
There's a reference  in "SBWin.exe" to "ScoreBoard.Library".

I know this is a namespace issue or something really simple and it may work fine, but when it doesn't look like Rocky's code, as simple as this is, I wonder if I've done something that'll bite me in the butt later. 

Has anyone seen anything like this before and has a simple - "oh you forgot to..." answer?

Geezer butt biting just ends up in bad Karma.  Any help at all would be greatly appreciated (and gets you beers when you're in Indianapolis).   :D

RockfordLhotka replied on Friday, June 26, 2009

It does sound like a namespace issue, but I don't know the answer. Maybe the LINQ to SQL designer isn't honoring the VB root namespace or something?

Try adding a class directly to your DalLinq project, and writing some code to use the context - just to find out the full type name of the context object.

nhwilly replied on Friday, June 26, 2009

Thanks for the reply, Rocky.

I did put a class in there and purposely got it wrong  (yeah, right) and let the vs2008 error handler "suggest" a correction.

My original:

- Using ... GetManager(DalLinq.Database.ScoreBoard)

Seems the following work:

-Using ... GetManager(Global.ScoreBoard.DalLinq.Database.ScoreBoard)

Looks like the database name matches the inferred first segment of the namespace name and maybe it doesn't like that.  I don't actually have a namespace of "ScoreBoard" but perhaps one is inferred from "ScoreBoard.Library"

Is there a possibility that I'm using "ScoreBoard" in a few too many places and there's  some kind of confusion?  I'll experiment and let you know.

 

nhwilly replied on Friday, June 26, 2009

OK, I edited this post and that means that my useful secondary observations didn't get sent out in an email.  I didn't realize that it worked that way until I got half my message back; so this is a bump.

 

RockfordLhotka replied on Friday, June 26, 2009

You certainly could have some sort of ambiguity problem. I've run into that sort of thing quite a bit, especially when project names (and namespaces) match entity or class names.

Copyright (c) Marimer LLC