SubSonic Forums
All Your Database Are Belong To Us

already contains a definition

Latest post 10-24-2008 12:52 AM by ranomore. 6 replies.
  • 10-15-2008 11:31 PM

    already contains a definition

    I'm using the final version of 2.1.

    I've redone my database and made some significant changes.

    A couple of the more important ones are that I now have some columns which have a unique constraint, some other constraints where ID's rely on another table, etc. All of thise using SQL Server 2005. I'm also writing code for WinForms.

    Before I made these changes, SubSonic would regen the database fine. Now it doesn't seem to finish generating the code, but doesn't yield any errors upon generation -- only when I load it in Visual Studio to compile.

    It says that one of my tables already contains that definition.

    I've looked, there is not duplicate table in the database and also not a duplicate column name in that table.

    What's also weird is that it doesn't seem to be generating all the supporting methods such as MarkNew, Save, etc.

    Here is my app.conf, with the names changes to protect the innocent :)

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false" />
      </configSections>
      <appSettings>
      </appSettings>
      <connectionStrings>
        <clear />
        <add name="Some_DAL"
             connectionString="
                Data Source=SomeServer;
                Database=SomeDatabase;
                Integrated Security=true;" />
      </connectionStrings>
      <SubSonicService defaultProvider="Some_DAL">
        <providers>
          <clear />
          <add name="Some_DAL"
               type="SubSonic.SqlDataProvider, SubSonic"
               connectionStringName="Some_DAL"
               generatedNamespace="Dingo.DAL" />
        </providers>
      </SubSonicService>
      <compilation debug="true" defaultLanguage="C#" />
    </configuration>

  • 10-18-2008 3:24 PM In reply to

    Re: already contains a definition

    Any thoughts?

    Still not working.

  • 10-18-2008 3:28 PM In reply to

    Re: already contains a definition

    I've pointed the app.config to the old database and it generated fine -- telling me the app.config is fine but it 2.1 just can't handle constraints properly, so I think for the moment I'm going to assume 2.1 is still buggy and not production ready.

     

  • 10-21-2008 10:01 PM In reply to

    • ranomore
    • Top 10 Contributor
    • Joined on 11-05-2007
    • Salt Lake City
    • Posts 322

    Re: already contains a definition

    That's rather harsh, don't you think? Sounds like a variant of NIH syndrome to me--you didn't build it, so it must be the problem...

    EDIT: It would be much more helpful to provide stack traces and error messages.

  • 10-23-2008 11:22 PM In reply to

    Re: already contains a definition

    You might want to check your generated files wherever VS says there is an error. I've encountered this when I switched from plural to singlar generated tables names (with the fixPluralClassNames="true"). In my case, there were two definitions in the generated file for the same table. One with signlar and one with a plural name.


    ------------------
    Boyan Kostadinov
    Blog: http://blog.tech-cats.com
    Resume: http://boyan.tech-cats.com/resume
    Portfolio: http://boyan.tech-cats.com/portfolio

  • 10-24-2008 12:17 AM In reply to

    Re: already contains a definition

    The only change was a constraint. If I remove the constraints, it generates perfectly. I'm using the Sql IDE to create these contraints via diagrams.

    SubSonic, during the DAL generation, does not generate errors. This is what makes it difficult to hunt down. I neither know enough of SubSonics internal code to track it down nor have the time to learn the internals of SubSonic. I posted here in hopes someone else would go "oh yeah, I ran in to that before... it's X" or "here is your mistake", failing that -- I was going to give up for the time being.

    The errors are when I compile the DAL code. If I look at the code, it visually looks like stuff is missing. Closing curly brackets are out of indention, some methods aren't filled with code (e.g. Save).

    I don't think it's harsh in what I said, you are taking it personal. What I'm saying is that for my situation, SubSonic 2.1 isn't ready for what I need. For what you and others need, it may run smoothly -- and that's great. It even ran smoothly for me until I added constraints. I need constraints for the project I'm using. Having constraints is more important than having SubSonic, while other projects it would be the reverse (they are fairly small and I have no need to worry of things stomping on bad data).

    The time I had was burnt up already last week so I'll have to wait until another oppurtunity comes up before I can expend time figuring out the bug.

    Lastly, ranamore, I'm sorry if I offended you.

  • 10-24-2008 12:52 AM In reply to

    • ranomore
    • Top 10 Contributor
    • Joined on 11-05-2007
    • Salt Lake City
    • Posts 322

    Re: already contains a definition

    Is it possible to post the SQL for the tables and the new constraints that are causing the problem?

    Also, you can set enableTrace="true" in your SubSonicService element like so:

      <SubSonicService defaultProvider="Some_DAL" enableTrace="true">

    and then re-generate your DAL, you may be able to get a closer look at the SubSonic internals (via your Output window) to see if anything stands out.

    No worries. :)

Page 1 of 1 (7 items) | RSS