Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update Linq .dbml schema in VS2008

Posted on 2008-10-09
3
Medium Priority
?
3,857 Views
Last Modified: 2013-11-11
Hello,
I am trying to update the Linq schema within VS2008 - when I make changes to the underlying Sql database. I have tried using SqlMetal but if I replace the existing .dbml file in my project with the SqlMetal .dbml file I get an error pointing to the layout file. If I delete the layout file, I am then able to open the new .dbml in VS file but there is no longer a valid datacontext - there all code that was depending on this Linq datacontext fails regardless if I rebuild the solution.

Here is the current SqlMetal command line (which seems to work fine?):
sqlmetal.exe /conn:"server='itsa1'; database='myinsbusiness'; user='admin'; password='password'" /dbml:"C:\Program Files\MyInsBusinessFetch\SqlData\MyInsBusiness_LinqDB.dbml" /sprocs /views

So my question is how do rebuild my .dbml to use within VS2008?
0
Comment
Question by:jherington
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Accepted Solution

by:
naspinski earned 2000 total points
ID: 22684210
You can use SQLMetal.exe to generate your dbml and or cs/vb file. Use a pre-build script to start it and target the directory where your datacontext project belongs.

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sqlmetal.exe
  /server:<SERVER>
  /database:<database>
  /code:"path\Solution\DataContextProject\dbContext.cs"
  /language:csharp
  /namespace:<your namespace>

I stole it from here: http://stackoverflow.com/questions/40022/best-way-to-update-linq-to-sql-classes-after-database-schema-change#40034
0
 

Author Closing Comment

by:jherington
ID: 31504745
Thank you. The link lead me to several other links that should prove to be very helpful. I am still somewhat confused...would the dbContext.cs file in your example in effect replace the dbml, layout and designer files?
0
 
LVL 16

Expert Comment

by:Ady Foot
ID: 26161848
Can anyone help me further with this?  I'm unsure how to use the sqlmetal application as naspinski has shown.  I too tried to use it as jherington and experienced the same result.

Regards,

Ady
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question