General Comments

Coordinator
Jul 20, 2007 at 8:42 PM
Edited Oct 9, 2007 at 4:24 AM
Please post general comments and questions about the project here. Thank you.
-Jason
Sep 10, 2007 at 8:03 PM
How do I get a source copy? I want to add the ability to connect to an Oracle database for field extraction.
Coordinator
Oct 9, 2007 at 4:20 AM
Edited Oct 9, 2007 at 4:24 AM

oaksong wrote:
How do I get a source copy? I want to add the ability to connect to an Oracle database for field extraction.


Hi,
I'm glad you're interested in expanding the project to Oracle. That is certainly a direction I want to see things move in. However, I would ask for your patience with the release of source code. My plan is to implement a plug-in interface for the project that would allow anyone to write and expand the project with a plug-in.

I'll admit, it's a little strange to think about a plug-in having a plug-in (since this project is a VS.NET plug-in), but I think this will really open a lot of doors for the project.

I'm pressed for time on my other projects right now, but when they settle down, my plan is to jump on this one again with full intensity. So, thanks for your patience and your interest in the project.

-Jason
Dec 8, 2007 at 4:45 PM
Hi,

Is there any samples (VB) of how to use these classes

Thanks,
Oded Dror
Coordinator
Dec 10, 2007 at 3:35 PM
Edited Dec 10, 2007 at 3:37 PM


odeddror wrote:
Hi,

Is there any samples (VB) of how to use these classes

Thanks,
Oded Dror


Hi Oded Dror,

I don't have any example code about how to use the entity and data access classes, but they should be fairly straight forward. Once you generate the code, create a new instance of the data access class and use it like this (assume your table was named "Customers" and you named your entity "Customer"):

Dim myDA As New CustomerDataAccess("server=localhost;integrated security=SSPI;initial catalog=Sales;")
Dim cust As Customer
Customer = myDA.Select("1234") 'assume customer number string is the key you choose
'then access the properties (columns from the table) like this:
cust.Name = "This is my new name"
'save the customer back to the database
myDA.Save(cust)

I hope that gives you a good start. Sorry about the lack of examples.
Coordinator
Dec 10, 2007 at 3:37 PM
I forgot to add, you should execute the SQL scripts in the database you are connecting to so that the stored procedures are created.
Jan 24, 2008 at 10:54 PM
Jason,

This is pretty darn slick. I've been looking for something like this, we (the company I work for) had a Macro in .NET 1.1 that did something similar to this (without the select all to a list) - we returned a dataset and/or datareader.

Couple of things I'd like to see in this:

1. Return a DataSet or DataReader (implement both) in either the Select All (as well as the List)
2. On the save - pass the object in as a REF and then just set the key fields on that object, rather than creating a new object.

This really is slicker 'n snot on a door knob (sorry - my southern slang coming out) :).

Great work - I think this will be something I use a lot.

Bill
Coordinator
Jan 25, 2008 at 6:56 PM
Hi Bill,

Thank you for the kind words. I'm glad you can get some use out of the project.

I'll take a look at the changes you suggested. I like the idea of returning a DataSet (or perhaps a typed DataSet... maybe this could be another plug-in). I also like your second idea of filling the original object rather than newing up another one.

The model I've tried to follow with the generated code separates the business logic from the data access class by using entity objects that get passed between them. I've used this model for quite a while; in numerous projects. I'm glad there are others that find it useful, too.

Happy coding!

-Jason
Mar 10, 2008 at 3:06 PM
Does this plugin work with the Express version of Visual Studio?

Thanks
Coordinator
Mar 10, 2008 at 5:19 PM

kramsallad wrote:
Does this plugin work with the Express version of Visual Studio?

Thanks


Hi kramsallad,
To tell the truth, I've never thought to test on Express. I am in the fortunate position to have the full program readily available to me. If you would like to be my test case for Express, I would be happy to help you where I can. Just run the installer and let me know if you have any issues or not.
Thanks!
-Jason
Mar 11, 2008 at 3:34 AM


whatsit wrote:

To tell the truth, I've never thought to test on Express. I am in the fortunate position to have the full program readily available to me. If you would like to be my test case for Express, I would be happy to help you where I can. Just run the installer and let me know if you have any issues or not.


I ran the installer, but nothing shows up under "Add new item"
Coordinator
Mar 11, 2008 at 2:17 PM
Edited Mar 11, 2008 at 2:18 PM


kramsallad wrote:

I ran the installer, but nothing shows up under "Add new item"


Hm... well, that answers that question, I guess. I will setup a virtual pc with VS Express on it and start testing. Are you using 2005 or 2008? Also, which edition are you using (web, etc.)?

Thanks.
-Jason
Mar 11, 2008 at 4:07 PM
I am using Microsoft Visual Basic 2005 Express Edition Version 8.0.50727.42. This version appears to only use .Net 2.0, so that may be the problem. It may work with the 2008 version because it uses .NET 3.5. I don't know, just a thought.
Apr 2, 2008 at 3:34 PM
After Install, it does NOT show as an installed template in VS 2008 Professional. I noticed you closed the issue, but I believe it is still there.
cheers,
yoursaid
Coordinator
Apr 3, 2008 at 3:47 PM

yousaid wrote:
After Install, it does NOT show as an installed template in VS 2008 Professional. I noticed you closed the issue, but I believe it is still there.
cheers,
yoursaid

Hi yousaid,

Thanks for your feedback. If you are refering to work item #3376 "New project type does not appear after install," The project does not install as a project template. It installs as a project item "template" that fires off a wizard. The issue was closed because it wasn't really an issue.

1) Open Visual Studio 2008
2) Navigate through the menus like so: File -> New -> Project
3) Select “Class Library” from the “New Project” window and name your project
4) Once the project is created, navigate through the menus like so: Project -> Add New Item (CtrlShiftA)
5) You should see “Class Builder Wizard” as one of the options in the “Add New Item” dialog box. Highlight “Class Builder Wizard,” name your class, and click the “Add” button
6) The wizard will start.

If you follow the steps above, does the wizard start for you? Please let me know if the problem persists and I will look into it further.

Thank you.
-Jason
Coordinator
Apr 3, 2008 at 8:03 PM

kramsallad wrote:
I am using Microsoft Visual Basic 2005 Express Edition Version 8.0.50727.42. This version appears to only use .Net 2.0, so that may be the problem. It may work with the 2008 version because it uses .NET 3.5. I don't know, just a thought.


Hi kramsallad,

After looking into your issue further, it appears that it is not a limitation of the Class Builder Wizard, but is an issue with express versions of Visual Studio. If you look at this comparison chart of the different Visual Studio editions: http://msdn2.microsoft.com/en-us/vstudio/aa700921.aspx, you will notice that under the "Extensibility" section it explicitly states that add-ins and packages cannot be used with the "free" versions of VS.

So, I'm afraid the final verdict is that it won't work with version below the "Standard" edition of VS.

Thanks for your patience while I researched your issue.

-Jason
Apr 6, 2008 at 4:12 PM
Yes, following the Steps, it works like a Champ in VS 2008 PRO, BUT I have a new issue
an ERROR that states "No parameterless constructor defined for this object"
Here is what I did, perhaps I am doing something wrong.

Assume that I have a table named "Customers" with these fields.
CustomerID Int
FirstName Nvarchar
LastName Nvarchar

After generating the classes, I have two files named "customers" and "customersDataAccess".
I put the "customers" In my BLL folder and the "CustomerDataAccess"
in my DataAccessFolder both under my App_code folder.
Now I have a page named Default.aspx and codebehind Default.aspx.vb. I am using VB.Net and VS pro 2008.

Now I drag a Gridview and drop it in Default.aspx and in configuring the DataSource I choose, OBJECT, click next, Then I choose CustomerDataAccess, then I click Next, from the List of OBJECTS, I choose SelectAll (custmers) and finish.

Everything looks ok, but HOWEVER, when I run the application, I get this error,

"No parameterless constructor defined for this object"

Here is the entire Stack
-----------------------------------
Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


MissingMethodException: No parameterless constructor defined for this object.
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +268
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +127
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1960
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041




Where did I go wrong?
I have to say THIS IS A GREAT TOOL, no dll, no special configs, etc, THANKS man. I need to get this working. Adds many years to any Developer's life !!
Cheers,
yousaid


whatsit wrote:

yousaid wrote:
After Install, it does NOT show as an installed template in VS 2008 Professional. I noticed you closed the issue, but I believe it is still there.
cheers,
yoursaid

Hi yousaid,

Thanks for your feedback. If you are refering to work item #3376 "New project type does not appear after install," The project does not install as a project template. It installs as a project item "template" that fires off a wizard. The issue was closed because it wasn't really an issue.

1) Open Visual Studio 2008
2) Navigate through the menus like so: File -> New -> Project
3) Select “Class Library” from the “New Project” window and name your project
4) Once the project is created, navigate through the menus like so: Project -> Add New Item (CtrlShiftA)
5) You should see “Class Builder Wizard” as one of the options in the “Add New Item” dialog box. Highlight “Class Builder Wizard,” name your class, and click the “Add” button
6) The wizard will start.

If you follow the steps above, does the wizard start for you? Please let me know if the problem persists and I will look into it further.

Thank you.
-Jason

Coordinator
Apr 6, 2008 at 11:08 PM

yousaid wrote:
...
After generating the classes, I have two files named "customers" and "customersDataAccess".
I put the "customers" In my BLL folder and the "CustomerDataAccess"
in my DataAccessFolder both under my App_code folder.
Now I have a page named Default.aspx and codebehind Default.aspx.vb. I am using VB.Net and VS pro 2008.

Now I drag a Gridview and drop it in Default.aspx and in configuring the DataSource I choose, OBJECT, click next, Then I choose CustomerDataAccess, then I click Next, from the List of OBJECTS, I choose SelectAll (custmers) and finish.

Everything looks ok, but HOWEVER, when I run the application, I get this error,

"No parameterless constructor defined for this object"
...


Hi yousaid,

I'm glad you were able to get the wizard to work for you and generate code with it.

When I have used the generated classes with a web project in which I use my data like you describe, I have had to add a default constructor (a New() that doesn't have any parameters passed into it) on the XYZDataAccess class. You would add something like:

//VB.NET
    Public Sub New()
        Me.New(ConfigurationManager.ConnectionStrings("MyDatabaseConnString").ConnectionString)
    End Sub
//C#
    public CustomerDataAccess() : this(ConfigurationManager.ConnectionStrings["MyDatabaseConnString"].ConnectionString)
    {
    }

You'll notice that I am pulling the database connection string from the Web.config instead of having it passed into the class. Also, note that you should not delete the New(dbConn As String)
Sub since it is required by this overloaded constructor.

All of this is required because of a limitation in the ObjectDataSource in web projects. It won't allow you to define any parameters to pass into the data access class when it creates its instance of it.

I hope that helps. Please reply with any other questions or comments.

Thank you.
-Jason
Apr 7, 2008 at 7:32 PM
Edited Apr 7, 2008 at 7:32 PM
Hello Jason,
THANKS FOR YOUR REPLY, It woked AFTER adding to XYZDataAccess class, (customers in my case), per your reply.

Public Sub New()
Me.New(ConfigurationManager.ConnectionStrings("MyDatabaseConnString").ConnectionString)
End Sub
-------------------------------------------------------------
in the class Declaration, HOWEVER, ONLY one function SELECTALL works.

Public Function SelectAll() As List(Of Customers)
Dim objs As List(Of Customers) = New List(Of Customers)
Dim sql As String = "dbo.Customers_SelectAll"
Dim comm As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(sql, Me.m_DBConn)
comm.CommandType = System.Data.CommandType.StoredProcedure ...... more codes.

The SELECT (Update) function looks like this, it DOES NOT WORK:
Public Function Select(ByVal CustomerId As Integer, ByVal firstname As String, ByVal Lastname As String, ByVal Title As String, ByVal PostedOn As Date) As Customer
Dim obj As Customer = New Customer ....... more codes.

HOWEVER, The Other 3 functions, SAVE, (insert) , SELECT (insert), and Delete do not work..
Each throws this error:

--------------------------------------------------------------------------
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'SELECT' that takes parameters of type 'Customers'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'SELECT' that takes parameters of type 'CUSTOMERS.

Source Error:

--------------------------------------------------------------------------
This error implies that the classes are not there, BUT they are. DO I have to generate the UPDATE, INSERT & DELETE functions manually or am I missing something?
Any Ideas as to why it's unable to find the functions EVENTHOUGH the grid seems to find them. By this I mean, Update & Delete are enabled.
Thanks again,
yousaid
Coordinator
Apr 7, 2008 at 9:16 PM


yousaid wrote:
Hello Jason,
THANKS FOR YOUR REPLY, It woked AFTER adding to XYZDataAccess class, (customers in my case), per your reply.

...

HOWEVER, The Other 3 functions, SAVE, (insert) , SELECT (insert), and Delete do not work..
Each throws this error:

--------------------------------------------------------------------------
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'SELECT' that takes parameters of type 'Customers'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'SELECT' that takes parameters of type 'CUSTOMERS.

...


Hi yousaid,

Once again, because of the way the ASP.NET controls are setup, you will need to modify the methods of the CustomersDataAccess class that are not working for you. The ASP.NET controls require that the same object be passed back and forth (in this case, the object "Customers"). If you create an overload of the methods in question (similar to what we did with the constructor), you should be able to fix the problem with only a few lines of code. Something like:

   Public Function Select(cust As Customers) As Customers
      Return Select(cust.CustomerId, cust.firstname, cust.Lastname, cust.Title, cust.PostedOn)
   End Function

Another note: When you are generating your objects, be sure to modify the "Key Columns" collection in the table properties and remove any columns that are not part of the key you select by. This way, you don't have to have all of the customer's information just to retrieve it from the database; instead you would just need the CustomerId or some other identifying (key) piece of data.

I hope that helps.

Thank you.
-Jason
Coordinator
Apr 9, 2008 at 9:58 PM
To All: Please Note
I have added a couple code-use examples on the home tab of this project. You can download a web example or a windows example. Have a look at them and post your questions here.
Thank you.
-Jason
Apr 10, 2008 at 8:34 PM
Hello Jason,
I could not get mine to work, so I ported your C# sample to VB and it works !! I am using your ported version as a learning tool to see waht i am doing wrong.
I noticed in your sample, you only generated a few DB fields, except for the SAVE method, but in mine, all DB fields are generated.
How did you do it?
If you give an email, I can send you the VB version of your sample for others to use if they want to.
This is a GREAT Tool. Good job !
cheers,
yousaid
Coordinator
Apr 10, 2008 at 8:52 PM

yousaid wrote:
Hello Jason,
I could not get mine to work, so I ported your C# sample to VB and it works !! I am using your ported version as a learning tool to see waht i am doing wrong.
I noticed in your sample, you only generated a few DB fields, except for the SAVE method, but in mine, all DB fields are generated.
How did you do it?
If you give an email, I can send you the VB version of your sample for others to use if they want to.
This is a GREAT Tool. Good job !
cheers,
yousaid


Hi yousaid,

I sent you a PM with my email address. I'll gladly post your project. Thank you, in advance.

I don't think I understand what you mean by "... you only generated a few DB fields, except for the SAVE method, but in mine, all DB fields are generated."

If you are refering to the number of table columns used as parameters in the DataAccess class, you can control that while the wizard is running by clicking on your table, selecting the "Key Fields" property on the right, and clicking the elipsis button ("..."). Once the collection editor opens, remove any of the columns that shouldn't be used as a key field by clicking on them and then clicking the "remove" button.

Thank you.
-Jason
Apr 11, 2008 at 3:14 AM
Greetings,,
I have sent it. Let me know if you don't get it. I wll be building a larger sample app with this tool and post it for others to learn from. For now, I only do VB (still learning C#). This is a great tool.
Yes, you answered my question about the table columns.
Just another question, is there a way to select all tables in a DB at one time for code genetion? Right now it seems you have to select single tables and repeat till all tables are generated. Other than the inability to do Linq, I am of the opimion that this tool beats Subsonic and SqlMetal for it's simplicity and ease of use.
Cheers,
yousaid
Cheers and Great job on this tool


whatsit wrote:

yousaid wrote:
Hello Jason,
I could not get mine to work, so I ported your C# sample to VB and it works !! I am using your ported version as a learning tool to see waht i am doing wrong.
I noticed in your sample, you only generated a few DB fields, except for the SAVE method, but in mine, all DB fields are generated.
How did you do it?
If you give an email, I can send you the VB version of your sample for others to use if they want to.
This is a GREAT Tool. Good job !
cheers,
yousaid


Hi yousaid,

I sent you a PM with my email address. I'll gladly post your project. Thank you, in advance.

I don't think I understand what you mean by "... you only generated a few DB fields, except for the SAVE method, but in mine, all DB fields are generated."

If you are refering to the number of table columns used as parameters in the DataAccess class, you can control that while the wizard is running by clicking on your table, selecting the "Key Fields" property on the right, and clicking the elipsis button ("..."). Once the collection editor opens, remove any of the columns that shouldn't be used as a key field by clicking on them and then clicking the "remove" button.

Thank you.
-Jason

Coordinator
Apr 11, 2008 at 3:56 PM

yousaid wrote:
Greetings,,
I have sent it. Let me know if you don't get it. I wll be building a larger sample app with this tool and post it for others to learn from. For now, I only do VB (still learning C#). This is a great tool.
Yes, you answered my question about the table columns.
Just another question, is there a way to select all tables in a DB at one time for code genetion? Right now it seems you have to select single tables and repeat till all tables are generated. Other than the inability to do Linq, I am of the opimion that this tool beats Subsonic and SqlMetal for it's simplicity and ease of use.
Cheers,
yousaid
Cheers and Great job on this tool


Hi yousaid,

I have not received your email, yet. I checked my spam folder and its not in there either.

To answer your question: Currently there is not a way to generate code for multiple tables at once. This is a feature that is a little further down the road than I can think about, right now. The current architecture doesn't allow for this and it would take a bit of tweeking to get it done. I agree that generating code for multiple items at once would be very handy, though.

Currently, I'm trying to learn enough about Oracle to create a plug-in for that database. The Oracle Express edition is free and I'm working with that. That is why I cannot add features to the existing plug-ins, right now (I'm too busy).

As far as LINQ is concerned. I try to generate code that isn't specific to a version of the framework. That way, the plug-in will continue to work for VS 2005 (.NET 2.0) projects, as well as later versions (VS 2008 & .NET 3.0+). However, you can certainly perform LINQ queries on the collections returned from the DataAccess classes. The generic List<T> that is returned will let you do simple LINQ queries with the Where() method. That is a feature I have used several times in VS 2008 projects. As long as your project is built with the 3.0 or 3.5 framework, you can certainly use LINQ.

Thanks again for your support. I'll keep looking for your email.
-Jason
Apr 11, 2008 at 7:07 PM
Edited Apr 11, 2008 at 7:18 PM
Greetings,
That is strange. I copied myself and I did recieve the copy, looks like your ISP is filtering out ZIP files.
Anyway, I have uploaded it to my site. So download it from here http://www.cbian.com/Listfiles.aspx.
If you get the default error page on Site LOAD, click on the the DownLoads link and it should load. (Don't know why the site is throwing that error and I have not had time to update it)
The file to Download is called: NorthWindsampleWeb.
Let me know when you get it so I can delete it.
cheers,
yousaid.


whatsit wrote:

yousaid wrote:
Greetings,,
I have sent it. Let me know if you don't get it. I wll be building a larger sample app with this tool and post it for others to learn from. For now, I only do VB (still learning C#). This is a great tool.
Yes, you answered my question about the table columns.
Just another question, is there a way to select all tables in a DB at one time for code genetion? Right now it seems you have to select single tables and repeat till all tables are generated. Other than the inability to do Linq, I am of the opimion that this tool beats Subsonic and SqlMetal for it's simplicity and ease of use.
Cheers,
yousaid
Cheers and Great job on this tool


Hi yousaid,

I have not received your email, yet. I checked my spam folder and its not in there either.

To answer your question: Currently there is not a way to generate code for multiple tables at once. This is a feature that is a little further down the road than I can think about, right now. The current architecture doesn't allow for this and it would take a bit of tweeking to get it done. I agree that generating code for multiple items at once would be very handy, though.

Currently, I'm trying to learn enough about Oracle to create a plug-in for that database. The Oracle Express edition is free and I'm working with that. That is why I cannot add features to the existing plug-ins, right now (I'm too busy).

As far as LINQ is concerned. I try to generate code that isn't specific to a version of the framework. That way, the plug-in will continue to work for VS 2005 (.NET 2.0) projects, as well as later versions (VS 2008 & .NET 3.0+). However, you can certainly perform LINQ queries on the collections returned from the DataAccess classes. The generic List<T> that is returned will let you do simple LINQ queries with the Where() method. That is a feature I have used several times in VS 2008 projects. As long as your project is built with the 3.0 or 3.5 framework, you can certainly use LINQ.

Thanks again for your support. I'll keep looking for your email.
-Jason

Coordinator
Apr 11, 2008 at 8:21 PM
Got it. Thanks, yousaid.
-Jason
May 12, 2008 at 3:33 PM
I get errors with the sql server int data type (going to integer) and date time fields.  Any thoughts on a resolution or helping me understand the problem would be appreciated.  When I populate the list with tables that have those fields it causes an exception on every record which slows things down to a crawl... here's some run time info:

  • log_id is a int type, auto number in the database.
  • log_id was defined by the generator as Integer
  • prop.name = log_id
  • prop.PropertyType = System.Int32
  • Exception text:  Int32Converter cannot convert from System.Int32.

The line of code that causes the error is the SetValue line here in the file with the data reader passed in:

 

If (dr(prop.Name).Equals(System.DBNull.Value) <> True) Then

 

    prop.SetValue(

Me, prop.Converter.ConvertFrom(dr(prop.Name)))

 

 

End If

 

Coordinator
May 12, 2008 at 4:04 PM

bpell wrote:
I get errors with the sql server int data type (going to integer) and date time fields.  Any thoughts on a resolution or helping me understand the problem would be appreciated.  When I populate the list with tables that have those fields it causes an exception on every record which slows things down to a crawl... here's some run time info:

  • log_id is a int type, auto number in the database.
  • log_id was defined by the generator as Integer
  • prop.name = log_id
  • prop.PropertyType = System.Int32
  • Exception text:  Int32Converter cannot convert from System.Int32.

The line of code that causes the error is the SetValue line here in the file with the data reader passed in:

 

If (dr(prop.Name).Equals(System.DBNull.Value) <> True) Then

 

 

    prop.SetValue(

Me, prop.Converter.ConvertFrom(dr(prop.Name)))

 

 

 

End If

 

 

 

I see the same problem. Thank you for bringing attention to it. I will fix it ASAP.
Right now, it appears that I'm running into a limitation with the Framework's ComponentModel.Int32Converter class that I didn't realize existed. I appologize for the inconvenience and I'll PM you when the fix is completed.
Thanks.
-Jason
May 12, 2008 at 4:08 PM
Sounds good, thanks for the quick response!  Also, apologies for not putting this in the Issue Tracking section (I can start an issue if you want).  I skipped my morning coffee this morning and my brain was running on slow motion when I posted this!  :)

This is a great project by the way.  It creates the data layer in a straight forward way that's easy to use as needed.  Great work. 
Coordinator
May 12, 2008 at 5:51 PM


bpell wrote:
Sounds good, thanks for the quick response!  Also, apologies for not putting this in the Issue Tracking section (I can start an issue if you want).  I skipped my morning coffee this morning and my brain was running on slow motion when I posted this!  :)

This is a great project by the way.  It creates the data layer in a straight forward way that's easy to use as needed.  Great work. 


I just sent you a PM, but I got an error message that makes me think you might not get it. So, I'll reply here, too.

I just released a new build (3.0.1) that should have this problem fixed. I was just about to use it to generate some code for one of my projects when I saw your message and figured I better fix it for your sake and mine. ;)

Don't worry about the bug tracker. I use it, but with a small project like this one, I'm not too concerned about it.

Anyway, let me know your results with the latest build.

Thanks.
-Jason
May 12, 2008 at 7:54 PM
Just installed the new build.  Works like a charm.  Great work Jason!
May 13, 2008 at 9:04 PM
Edited May 13, 2008 at 9:06 PM

I still have the same problem. Infact, I am getting same behavior on two different machines.

Machine  #1: Laptop, XP SP1, VS 2008 Pro and VS Web Developer installed. VS Extensions is also installed  including Dynamic Data preview, etc.

Machine #2: Is a Desktop with same applications installed.

Here is what I have done:

(1) Uninstalled existing 2.2. xxx versions.
(2) Installed 3.1 xxx.
Then tried to use the wizard from an app., I get the error I posted.

Then I reinstalled v2.2.xx and THEN installed 3.1.xxx  WITHOUT unistalling 2.2.xxx version.

Then tried to use the wizard from an app, The error is NOT thrown, BUT the WIZARD loads a blank window and does not pick up the DB, just blank.

Behavior is consistent on both machines. I have even uninstalled it from  GAC, but still not working.
Here is the link to error
http://www.codeplex.com/ClassBuilderWizard/WorkItem/View.aspx?WorkItemId=4683

Just wondering....... Do I need to Delete every app built with v2.2 in the GAC?
Any ideas?
Thanks
yousaid




Coordinator
May 13, 2008 at 10:38 PM
Hi yousaid,

I just updated the installer for 3.0.2 with a fix that will hopefully fix your issue. The version of the program is still 3.0.2 (no code changes); just a configuration change on the installer. So, please re-download the 3.0.2 installer, uninstall all previous versions, and install the downloaded 3.0.2 package.
As always, please let me know your results.

Thanks.
-Jason
May 14, 2008 at 9:07 PM
THIS IS a cross Post. I made a mistake and posted it in  Issues.
----------------------------------------------------------------------

GREAT JOB, it works now !
The new build fixed the issue on both systems. You can now close this issue. I have one question that is


UNRELATED.

I noticed this line in the generated class file:
--------------------------------------------------------------
VB
Dim newEx As System.Exception = New System.Exception("From Save. See inner exception.", ex)
--------------------------------------------------------------
Specifically, I am refering to " See inner Exception". What exactely is it referencing?
This line only occurs in tables with Foreign Keys. Is there an easy way to use a related table? Eg.
Products Table has Category Id as a foreign key. But I want the category name to be rendered in a dropdown FROM the CATEGORY table.
Any Ideas?
Thanks again and GREAT JOB !
cheers,
yousaid
Coordinator
May 15, 2008 at 2:08 PM


yousaid wrote:
...
UNRELATED.

I noticed this line in the generated class file:
--------------------------------------------------------------
VB
Dim newEx As System.Exception = New System.Exception("From Save. See inner exception.", ex)
--------------------------------------------------------------
Specifically, I am refering to " See inner Exception". What exactely is it referencing?
This line only occurs in tables with Foreign Keys. Is there an easy way to use a related table? Eg.
Products Table has Category Id as a foreign key. But I want the category name to be rendered in a dropdown FROM the CATEGORY table.
Any Ideas?
Thanks again and GREAT JOB !
cheers,
yousaid


Hi yousaid,
The newest feature of the Data Access class is that it keeps a list of all of the errors that occured in the instance you are using. This seems to be a good way to let your business logic know about problems on the data layer without tearing down your app domain by throwing an exception.

You will notice that the System.Exception class has a property on it called "InnerException." If you were to read through the list of errors the Data Access class encountered, you would need to look at this property to see what the error actually was. The note about "See inner Exception" is just a way of telling where (what method) the exception was thrown. If that was not there and you performed multiple operations with the Data Access class, you might not know which of your method calls actually failed.

As far as your category problem goes: I would generate an entity and data access class for the category table. You can use the SelectAll method to retrieve the categories and populate your dropdown. Make sure to bind the id / foreign key of the category to the data value of the list.

Thanks.
-Jason
Dec 31, 2008 at 4:53 AM

I know you were planning on releasing the code, do you have a time frame?  I would love to see the code and help if I can.

Thanks,

Dave

Coordinator
Dec 31, 2008 at 5:14 AM
Hello,

Thank you for your interest in the project.

You can certainly download the source code by going to the Source Code tab at the top of this page and clicking on the download link. Everything having to do with the wizard has been checked into Codeplex's source control system.

Thanks.
-Jason
Jan 1, 2009 at 2:53 AM
Thanks Jason for the very quick reply.

I did get the version 2 download, but the version 3 only shows me the Changeset.txt file.  Am I missing something?

I really like this project, use it all of the time with great success. 

Thanks again,
Dave
Coordinator
Jan 1, 2009 at 4:24 AM
Hi Dave,

The source code in the version 2 folder is actually the most recent version. I had thought about branching the source control, but ended up screwing something up with the TFS client tools.

Anyway, if you downloaded the version 2 source code, you actually have the most recent changes.

I hope that clarifies things; sorry for the confusion.

Thanks.
-Jason