none
Using GUID Primary Keys and other default column values RRS feed

  • Question

  • Is there a way to get LINQ to add the IsDBGenerated:=true flag to my GUID primary key columns that have the default value newsequentialid()?

    I am using SQLMetal.exe to gen the file and was hoping not to have to go through all 190 of my tables each and every time I have to re-gen the file and add the this property back in.  I am using SQLMetal rather than a DBML file because its "faster" but I did not discover this problem till just a few minutes ago. 

    Even if I had to build each item that is DB generated into some sort of custom file that gets used when sql metal runs that would be okay too.

    I started using SQL metal because the O/R designer has no way of tracking changes between it and the database which makes it mostly useless.  sqlmetal makes this easy, by just re-gening the whole file at a time.

     

    If I MUST create a utility to do this, I will, but I am hoping that someone knows of a QUICK way to solve this problem so that I can just add another item to my batch file for Sqlmetal and away I go.

     

    Cheers,

    B


    --------------------------------------------------------------------------------------------- No warranties are expressed or implied with any code being posted/emailed.
    Friday, May 28, 2010 12:25 AM

Answers

All replies

  • You might want to take a look at my add-in ( www.huagati.com/dbmltools ). It solves two of the issues you have mentioned;

    a) allows you to sync the DBML designer with the database, and

    b) allows you to set up rules for what default constraints (e.g. NewID, NewSequentialID(), GetDate() etc) should be treated as auto-generated. http://forum.huagati.com/topic35-update-from-database-default-value.aspx

    You can download it and get a trial license at www.huagati.com/dbmltools if you want to try it out.


    Kristofer - Huagati Systems Co., Ltd.
    Cool tools for Linq-to-SQL and Entity Framework:
    huagati.com/dbmltools (add-in with new features for the L2S and EF designers in VS2008 and VS2010)
    huagati.com/L2SProfiler (Query profiler for Linq-to-SQL and LLBLGen Pro)
    Friday, May 28, 2010 4:07 AM
    Answerer
  • I know about your software.  I have seen it advertised here by you before.  The thing is that I cannot properly evaluate your software with a limitation of 50 tables.  The system that I am involved in is MUCH MUCH bigger than that, like 190 tables/views/sprocs.  If you had an unlimited version that was time-limited AND run-limited say like 15 days and 100 runs (whichever is reached first) or something like that then I could evaluate it.

    Without such an evaluation I would be very hesitant to shell out $150.  I gotta know it'll solve the problem before I spend that kind of dough.

    I know you can't PM me on this forum but maybe we can find a way to chat about what you can do for me.  I can call you if that is an option for you.


    --------------------------------------------------------------------------------------------- No warranties are expressed or implied with any code being posted/emailed.
    Friday, May 28, 2010 4:08 PM
  • Hi Wizengamot,

    I saw you already got a full license - thanks for that. I hope it does what you need, and if not please let me know what is missing (always looking to improve it).

    For future reference: yes, if anyone need a trial license with a higher table/entity limit, the limit can be tweaked up on request (just drop a line to support@huagati.com ).

    Best regards,
    Kristofer


    Kristofer - Huagati Systems Co., Ltd.
    Cool tools for Linq-to-SQL and Entity Framework:
    huagati.com/dbmltools (add-in with new features for the L2S and EF designers in VS2008 and VS2010)
    huagati.com/L2SProfiler (Query profiler for Linq-to-SQL and LLBLGen Pro)
    Saturday, May 29, 2010 4:36 AM
    Answerer
  • Hi Wizengamot,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions?  

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, June 3, 2010 1:27 AM
    Moderator
  • Lingzhi,

    The software provided by Huagati is generally useful.  I have a number of support requests being generated now for him, so that I can request improvements and I have no doubt that he will improve it, based on what was posted by him above.

    I am, however, stunned that visual studio 2010 does not include the ability to do this.  I am sure this was an oft requested feature, and while I do not wish to offend Kristofer with this comment, but building a tool like this based on SQLMetal (so the naming would be the same as creating a DBML file) would be child's play, and I might still do that myself, even after spending the money on this tool suite.


    --------------------------------------------------------------------------------------------- No warranties are expressed or implied with any code being posted/emailed.
    Monday, June 7, 2010 4:10 PM