CodeSmith Community
Your Code. Your Way. Faster!

Error: Cannot create an abstract class.

Latest post 06-16-2006 10:52 AM by bdiaz. 8 replies.
  • 06-08-2006 5:25 PM

    • JKI
    • Not Ranked
    • Joined on 06-08-2006
    • Posts 5
    • Points 180

    Error: Cannot create an abstract class.

    Hi,

    I'm new to codesmith & .netTiers so you'll have to forgive me if I'm being stupid.

    I've run codesmith with .netTiers against my database, it's generated all the relevent code (which compiles fine).

    As a test I wanted to get a DetailsView working with an ObjectDataSet. I've created my ObjectDataSet and connected the DetailsView to it (that part works OK as it builds the fields in the view). When I try to run the page I get the error below. I don't have any custom code running at the moment, just a drag and drop ODS and a DetailsView.

    Any ideas?

    Thanks

    Jordan

    Cannot create an abstract class.

    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.MissingMethodException: Cannot create an abstract class.

    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.



    • Post Points: 35
  • 06-08-2006 6:29 PM In reply to

    Re: Error: Cannot create an abstract class.

    It appears that you're using an asbstract class for your source DataObject in your ObjectDataSource.  Can you post the control markup?

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 06-10-2006 4:16 AM In reply to

    • JKI
    • Not Ranked
    • Joined on 06-08-2006
    • Posts 5
    • Points 180

    Re: Error: Cannot create an abstract class.

    Hi,

    The code is below, thanks.

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"                                DataObjectTypeName="WantWebsite.Shop"
                DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetAll"   TypeName="WantWebsite.DataAccessLayer.Bases.ShopProviderBase"
                UpdateMethod="Update">
    </asp:ObjectDataSource>

            <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True"
                AutoGenerateRows="true" DataSourceID="ObjectDataSource1" Height="50px" Width="125px">


    I assume I shouldn't be binding the datasource to the WantWebsite.DataAccessLayer.Bases.ShopProviderBase class?

    Jordan
    • Post Points: 35
  • 06-10-2006 11:38 AM In reply to

    Re: Error: Cannot create an abstract class.

    TypeName="WantWebsite.DataAccessLayer.SqlClient.SqlShopProvider"

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 06-10-2006 12:38 PM In reply to

    • JKI
    • Not Ranked
    • Joined on 06-08-2006
    • Posts 5
    • Points 180

    Re: Error: Cannot create an abstract class.

    Thanks. When I use the SqlShopProvider I get another error.

    Any thoughts?

    No parameterless constructor defined for this object.

    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.MissingMethodException: No parameterless constructor defined for this object.

    • Post Points: 5
  • 06-11-2006 6:37 AM In reply to

    • JKI
    • Not Ranked
    • Joined on 06-08-2006
    • Posts 5
    • Points 180

    Re: Error: Cannot create an abstract class.

    After some searching of this forum I've found the answer. I just needed set the ObjectInstance on the ObjectCreating method

        protected void ObjectDataSource1_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
        {
            e.ObjectInstance = DataRepository.ShopProvider;
        }

    Thanks for your help

    Jordan
    • Post Points: 70
  • 06-16-2006 5:17 AM In reply to

    • Eudoxus
    • Top 500 Contributor
    • Joined on 06-09-2006
    • Posts 17
    • Points 290

    Re: Error: Cannot create an abstract class.

    Thanks for that, but could you post a link to where you found the solution, please? You've been a great help as this was really getting to me! :) Is there anyone who can say why the latest build (as opposed to ver 0.9.2) does away with no-code-databinding? Cheers, Matt.
    • Post Points: 5
  • 06-16-2006 6:34 AM In reply to

    • Eudoxus
    • Top 500 Contributor
    • Joined on 06-09-2006
    • Posts 17
    • Points 290

    Re: Error: Cannot create an abstract class.

    One other thing...

    ...I have the select working in a GridView, but I just don't get anything if I try to delete.  It posts-back, but nothing happens.
    If I edit and update I get an error.

    Did you get that/get round it?

    Matt.

    Error:

    Could not find a property named 'Id' on the type specified by the DataObjectTypeName property in ObjectDataSource 'ObjectDataSource1'.

    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: Could not find a property named 'Id' on the type specified by the DataObjectTypeName property in ObjectDataSource 'ObjectDataSource1'.

    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:

    [InvalidOperationException: Could not find a property named 'Id' on the type specified by the DataObjectTypeName property in ObjectDataSource 'ObjectDataSource1'.]
       System.Web.UI.WebControls.ObjectDataSourceView.BuildDataObject(Type dataObjectType, IDictionary inputParameters) +381
    

    • Post Points: 35
  • 06-16-2006 10:52 AM In reply to

    • bdiaz
    • Top 10 Contributor
    • Joined on 02-20-2006
    • Houston, TX
    • Posts 504
    • Points 15,290

    Re: Error: Cannot create an abstract class.

    After seeing all the problems that many users (myself included) were having with the ObjectDataSource, we have included several custom data source controls in the WebLibrary that work really well with the NetTiers generated data access layer and service layer components.

    Take a look at the Documentation thread for several examples:
    http://community.codesmithtools.com/forums/33/ShowForum.aspx

    Hope that helps!

    Bobby Diaz ------------------------------------------ Member of the .NetTiers team http://www.nettiers.com ------------------------------------------
    • Post Points: 5
Page 1 of 1 (9 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems