Login Skip Navigation LinksWilsonORMapper > Forums Search
Demo Version Demo Version
Download and try for yourself a fully working demo version, including sample apps and documentation.  The only limitation is that the demo version only works inside the debugger.

PayPal Subscribe
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
PayPal

User Login User Login
Log In
 
 
Reset Password

Wilson ORMapper Forums Wilson ORMapper Forums : Templates & More : New CodeSmith templates (based on the old templates)

Date Post
11/16/2006 5:42:38 PM I'm almost finished with a heavily-modified version of Paul Welter's templates. I don't want to release them until I do a little more testing, but I wrote about them on my blog so you can get an idea as to what's different. Feel free to check it out at http://demarzo.net/archive/2006/11/15/957.aspx and let me know what you think. When I publish the final templates (probably no later than tomorrow) I'll post a follow-up here.
11/24/2006 7:43:47 PM I just published the templates, which now include basic unit tests. Check it out here: http://demarzo.net/archive/2006/11/24/1058.aspx
11/26/2006 1:01:20 AM

Hi there,

I have just downloaded and started using your template with Codesmith 4.0. There a couple of questions I came up with:

1. Did you include a generator for the mapping file? I couldn't find it and the generator kept asking for a mapping file. In the end I had to fire up Codesmith 3.2 and use Paul Welter's to generate a Mapping.config file first.

2. I haven't checked the rest of the code but have found at least one decrepancy between the examples in your blog and the generated code. The method Retrieve<T>.RetrieveFirst() has no parameterless overload. The closest one expects a (string whereClause). I have just passed a String.Empty for the meantime.

3. This is the only method I've tried so far: Dog dog = Retrieve<Dog>.RetrieveFirst(String.Empty). Unfortunately the solution failed during runtime right at the point of instantiating objectSpace. The error message was:
<quote>
Exception Wilson.ORMapper.ORMapperException was thrown in debuggee:
ORMapper: Type could not be located in any loaded assembly - BernerLine.Data.DataAccess.Dog
</quote>

I can't quite figure out what this means. Any ideas why this comes up?

Thanks,
Dany.

11/27/2006 3:13:59 AM
  1. I didn't include Welter's generator file, though the one he had should work fine (barring compatibility issues with CodeSmith 4.0, but you can always use 3.2 with it).
  2. Thanks for the note -- I'll update my article to reflect this.
  3. It's tough to figure out without seeing your code, but some things I can suggest you check:
    1. Have you specified a different namespace for your Entities and Data Access layers?
    2. Did you create a project reference between both projects (this is not done automatically)?
    3. Do you have a Dog object in both namespaces?

Based on your example, the compiler seems to be looking for a Dog object in your Data Access namespace, not your Entity namespace. For example, the code this:

Dog dog = Retrieve<Dog>.RetrieveFirst(String.Empty)

... but the compiler sees this:

BernerLine.Data.DataAccess.Dog dog = Retrieve<BernerLine.Data.DataAccess.Dog>.RetrieveFirst(String.Empty)

The compiler should be looking for Dog in your entity namespace.

I hope that helps!

 - brian (http://www.demarzo.net)

 

11/27/2006 4:13:09 AM

Hi Brian,

Thanks for the quick reply. I have done everything as you mentioned in your check list. There's only one Dog class and it's in the Entities namespace, which is in a separate project. I have no idea why it's looking for that class in the DataAccess namespace.

If you like I can put up the code on my SVN site for you to have a look? I can email you privately for login/password to the server.

I have also bastardised the generated code a little, by changing the default Provider.Sql2005 to Provider.MsSql when it finds "System.Data.SqlClient" - but I don't think that has anything to do with this problem....hopefully.....

Please let me know if you have some time to look at my code.

Cheers,
Dany.

11/28/2006 4:13:59 AM

Sounds weird. Email me the SVN repo info or just a zipped copy of your code and I'll take a look.

 - Brian (brian@demarzo.net)

 

11/28/2006 2:41:44 PM

Problem found in your Mappings.config file --- the namespace and entity types must match your entities. In other words you have this:

<mappings version="4.2" defaultNamespace="BernerLine.Data.DataAccess">
  <entity type="BernerLine.Data.DataAccess.Dog" table="Dog" keyMember="_id">

... where you should have this:

<mappings version="4.2" defaultNamespace="BernerLine.Data.Entities">
  <entity type="BernerLine.Data..Entities">.Dog" table="Dog" keyMember="_id">


 - Brian
 - http://www.demarzo.net