Code Generation Error

Last post 01-10-2008 11:38 AM by ehudros. 12 replies.

Sort Posts:

  • Code Generation Error

    06-23-2006, 3:16 PM
    • Loading...
    • alexsimkin
    • Joined on 06-23-2006, 5:22 PM
    • Posts 5

    I was so excited to try BLinq, but... After I ran the tool (no errors) and got web-site created, the generated code cannot be compiled:

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0100: The parameter name 'CONTAINERs_ID' is a duplicate

    Source Error:

    Line 103:    // This method gets sorted and paged records of all CONTAINERs filtered by a specified field.
    Line 104:    // Do not change this method.
    Line 105:    public static IQueryable<CONTAINER> GetCONTAINERs(string tableName, Int32 CONTAINERs_ID, Int32 CONTAINERs_ID, Int32 CONTAINERs_ID, string sortExpression, int startRowIndex, int maximumRows) {
    Line 106:      IQueryable<CONTAINER> x = GetFilteredCONTAINERs(tableName, CONTAINERs_ID, CONTAINERs_ID, CONTAINERs_ID);
    Line 107:      return x.SortAndPage(sortExpression, startRowIndex, maximumRows, "ID");

     

  • Re: Code Generation Error

    06-23-2006, 4:51 PM
    • Loading...
    • phuff
    • Joined on 06-11-2002, 12:39 PM
    • Redmond, WA
    • Posts 547
    This sounds like it may be a bug in the Blinq code generator.  You can get around it by removing the duplicate CONTAINERs_ID parameters to the GetCONTAINERs and GetFilteredCONTAINERs methods.  Please tell me if this works for you.
    Polita Paulus

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Code Generation Error

    06-23-2006, 4:56 PM
    • Loading...
    • alexsimkin
    • Joined on 06-23-2006, 5:22 PM
    • Posts 5

    There are more of these actually. Here is the "Show Detailed Compiler Output" (below)

    I guess there is something in the schema that makes BLink go bannanas.

    ---

    C:\WINDOWS\system32> "C:\Program Files\LINQ Preview\Bin\csc.exe" /noconfig /fullpaths @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\coreweb\2138498a\e1e503be\3-ez6-o6.cmdline"


    Microsoft (R) Visual C# 2005 Compiler version 8.00.50916
    for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
    Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

    c:\CoreWeb\App_Code\StaticMethods.cs(105,100): error CS0100: The parameter name 'CONTAINERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(105,121): error CS0100: The parameter name 'CONTAINERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(111,109): error CS0100: The parameter name 'CONTAINERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(111,130): error CS0100: The parameter name 'CONTAINERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(125,87): error CS0100: The parameter name 'CONTAINERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(125,108): error CS0100: The parameter name 'CONTAINERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(318,103): error CS0100: The parameter name 'CYCLECOUNTs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(324,112): error CS0100: The parameter name 'CYCLECOUNTs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(336,89): error CS0100: The parameter name 'CYCLECOUNTs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(480,85): error CS0100: The parameter name 'ITEMs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(480,101): error CS0100: The parameter name 'ITEMs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(486,94): error CS0100: The parameter name 'ITEMs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(486,110): error CS0100: The parameter name 'ITEMs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(500,77): error CS0100: The parameter name 'ITEMs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(500,93): error CS0100: The parameter name 'ITEMs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(857,91): error CS0100: The parameter name 'PALLETs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(863,100): error CS0100: The parameter name 'PALLETs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(875,81): error CS0100: The parameter name 'PALLETs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1019,124): error CS0100: The parameter name 'PREFERREDLOCATIONs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1025,133): error CS0100: The parameter name 'PREFERREDLOCATIONs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1037,103): error CS0100: The parameter name 'PREFERREDLOCATIONs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1184,123): error CS0100: The parameter name 'RECEIVINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1184,152): error CS0100: The parameter name 'RECEIVINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1190,132): error CS0100: The parameter name 'RECEIVINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1190,161): error CS0100: The parameter name 'RECEIVINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1204,103): error CS0100: The parameter name 'RECEIVINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1204,132): error CS0100: The parameter name 'RECEIVINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1286,112): error CS0100: The parameter name 'RECEIVINGLINEs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1292,121): error CS0100: The parameter name 'RECEIVINGLINEs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1304,95): error CS0100: The parameter name 'RECEIVINGLINEs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1388,174): error CS0100: The parameter name 'RECEIVINGORDERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1394,183): error CS0100: The parameter name 'RECEIVINGORDERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1410,156): error CS0100: The parameter name 'RECEIVINGORDERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1498,112): error CS0100: The parameter name 'REPLENISHMENTs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1504,121): error CS0100: The parameter name 'REPLENISHMENTs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1516,95): error CS0100: The parameter name 'REPLENISHMENTs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1791,120): error CS0100: The parameter name 'SHIPPINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1791,148): error CS0100: The parameter name 'SHIPPINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1797,129): error CS0100: The parameter name 'SHIPPINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1797,157): error CS0100: The parameter name 'SHIPPINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1811,101): error CS0100: The parameter name 'SHIPPINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1811,129): error CS0100: The parameter name 'SHIPPINGHISTORies_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1896,109): error CS0100: The parameter name 'SHIPPINGLINEs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1902,118): error CS0100: The parameter name 'SHIPPINGLINEs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1914,93): error CS0100: The parameter name 'SHIPPINGLINEs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(1998,168): error CS0100: The parameter name 'SHIPPINGORDERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2004,177): error CS0100: The parameter name 'SHIPPINGORDERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2020,151): error CS0100: The parameter name 'SHIPPINGORDERs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2256,88): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2256,105): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2256,122): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2256,139): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2262,97): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2262,114): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2262,131): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2262,148): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2280,79): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2280,96): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2280,113): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2280,130): error CS0100: The parameter name 'STOCKs_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2791,103): error CS0100: The parameter name 'SITETOUSERS_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2797,112): error CS0100: The parameter name 'SITETOUSERS_ID' is a duplicate
    c:\CoreWeb\App_Code\StaticMethods.cs(2809,89): error CS0100: The parameter name 'SITETOUSERS_ID' is a duplicate

  • Re: Code Generation Error

    06-23-2006, 5:32 PM
    • Loading...
    • alexsimkin
    • Joined on 06-23-2006, 5:22 PM
    • Posts 5

    Polita,

    After I deleted all that duplicate parameters the application is actually started (and works fine...so far :)

    Alex

  • Re: Code Generation Error

    06-23-2006, 5:36 PM
    • Loading...
    • alexsimkin
    • Joined on 06-23-2006, 5:22 PM
    • Posts 5
    alexsimkin:

    Polita,

    After I deleted all that duplicate parameters the application is actually started (and works fine...so far :)

    Alex

    No, it doesn't work. I'm getting errors that look like this:

    'ITEMsDataSource' could not find a non-generic method 'GetITEMs' that has parameters: tableName, ITEMs_ID, ITEMs_ID1, ITEMs_ID2, sortExpression, maximumRows, startRowIndex.

    These ITEMs_ID, ..._ID1, ..._ID2 should be passed to those duplicate ITEMs_ID parameters that I deleted.

  • Re: Code Generation Error

    06-24-2006, 9:53 AM
    • Loading...
    • phuff
    • Joined on 06-11-2002, 12:39 PM
    • Redmond, WA
    • Posts 547

    Hi Alex- glad to hear it´s compiling.  The error you´re seeing now is because the ObjectDataSources that point to your methods still have multiple parameters, so they´re looking for methods with all the duplicate parameters.  You can fix that up by deleting the duplicate parameters in the parameter collection on each ObjectDataSource that points to one of the methods you had to change.  These will probably be on just GridView pages.

    Thanks for your patience.  I will look for the root cause of this issue when I return from vacation next week.  I´m posting this from an internet cafe in Spain, so it´s hard to figure out exactly what went wrong. :)

    Polita Paulus

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Code Generation Error

    06-24-2006, 9:03 PM
    • Loading...
    • alexsimkin
    • Joined on 06-23-2006, 5:22 PM
    • Posts 5

    Polita,

    OK, I'll try this, but it seems to me that I shouldn't delete duplicate parameters, rather I need to make them different like ITEM_ID1, ITEM_ID2, etc. If you need a database dump to reproduce this, just let me know.

    Alex

  • Re: Code Generation Error

    06-25-2006, 12:52 PM
    • Loading...
    • phuff
    • Joined on 06-11-2002, 12:39 PM
    • Redmond, WA
    • Posts 547

    Alex, a database schema dump would be really helpful.  You can omit the data.  I´ll send you a private message with an email address where to send it, and then I´ll post a workaround here as soon as I can repro and research it.

    Polita Paulus

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Code Generation Error

    07-10-2006, 4:21 PM
    • Loading...
    • xystus
    • Joined on 07-10-2006, 8:03 PM
    • Posts 1

    I am seeing this error too.  Blinq worked fine on our support database but stumbled on a production system "real" database.  If Alex has not been able to provide a schema, please let me know and I'll send ours.

    All I need now is the source to Blinq please ; ) so I can modify it to also generate a BLL layer a la the tutorial site (http://www.asp.net/learn/dataaccess/default.aspx?tabid=63) - then I can go on holiday for a few weeks! 

    Another feature I'd suggest is adding a facility to specify which tables to include (or exclude) in the generated application.  Often there will be billing record or transaction/audit tables that you really would not want editable.

    Anyway - nice work and an excellent way to deomnstrate the power of the new linq stuff.

     

     

  • Re: Code Generation Error

    07-10-2006, 5:39 PM
    • Loading...
    • phuff
    • Joined on 06-11-2002, 12:39 PM
    • Redmond, WA
    • Posts 547

    Alex sent his schema and we worked together to fix his issue.  If yours is the same as his, you'll need to do two things:

    1. For each compilation error, go to the method that has duplicate parameters and delete all but one of the identical parameters.  If the method calls into another method with the duplicate parameters, delete all but one parameter instance.

    2. For each compilation error you fixed, go to the webpage that shows data from this method.  This should be a page with a GridView on it.  From the ObjectDataSource on the page, remove all but one of the duplicate SelectParameters.

    Rerun the page.  It should all work after those changes.

    I did think about adding an option to specify which tables Blinq should include, but ultimately I decided that would be a messy option for a command line application.  You can delete the pages generated for tables you don't wish to expose, and the effect will be the same.

    Thanks for the suggestion and feedback, and I hope the fix works for you and you can go on holiday anyways. Smile

    Polita

    Polita Paulus

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Code Generation Error

    07-31-2006, 3:46 PM
    • Loading...
    • wkoscho
    • Joined on 07-28-2006, 12:13 PM
    • Posts 16

    I encountered the same problem.  It appears that if you have a table called TableA, with more than one foreign key:

       TableA.ItemId is a FK to the Item table and the Item table has a FK back to TableA.Id

       TableA.StoreId is a FK to the Store table and the Store table has a FK back to TableA.Id

    Then it generates a method for filtering by the various FKs, but since both the Item and Store tables have FK back toTableA.Id it generates a filter() method that takes two paramters, both with the same name: TableA_Id and TableA_Id.

    I guess you can rename TableA_Id to TableA_Id1 and TableA_Id2 to resolve this problem, but if you regenerate your code again, you hvae to keep fixing this manually.

    Hope this helps

    Bill

  • Re: Code Generation Error

    06-24-2007, 3:33 AM
    • Loading...
    • cliffs
    • Joined on 06-24-2007, 7:27 AM
    • Posts 1

    Is there a new version of BLINQ that addresses this issue? 

    From Bill's posting it seems the issue is caused by having a commonly named primary key field in multiple tables, i.e. "Id".  Unfortunately I use this naming scheme as well.  So I'm in a bind (no pun intended) unless I rename my pk cols.

     Thanks.

    Cliff

     

  • Re: Code Generation Error

    01-10-2008, 11:38 AM
    • Loading...
    • ehudros
    • Joined on 01-10-2008, 10:45 AM
    • Posts 1

    I'm having the same issues and I was wondering if a fix is available? After going through the code I can't say I understand how deleting all the extra keys wil
    maintain functionality. It seems that these values are foreign keys used to connect to other tables (for example in the GetFilteredXXX method generated for every
    table the tablename parameter is used to redirect the call to the relevant method with the respectful id).

    I may be confusing things as I have not actually studies the code thoroughly, but is the solution currently to delete all extra references and parameters from the
    data sources?
    Also, what can I do in the db level to prevent this from happening? (Bill suggested changing index names, but I didn't understand exactly how)

    Thanks, I can't wait to try this out (hopefully it would save me quite a few hours of coding)
    Ehud


     

Page 1 of 1 (13 items)
Microsoft Communities