Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 27th, 2011, 11:15 AM
Authorized User
 
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
Default Small changes throw project out of synch

Hi All,

I'm new to asp.net 3.5 using VWD. In the main I'm finding it excellent but one things is causing a lot of frustration with me.

I'm using Linq and whenever I change something that reconfigures the datacontext I'm having great difficulty getting the rest of the project in synch with the changes. The other day I changes the name of fieds in my database from ProjectNumber to ProjectNo simply for reasons of consistancy. I then spent a couple of hours trying to get my project to recognise the change. Eventually I had to re-create every form that used ProjectNumber to now use ProjectNo. Today I have added a temp table to the datacontext called 'Main' and now even though the project recognises the new table when I come to run, I get the error 'Main is not part of DataContextDataClasses.' I close the project and its staring right back at me in the middle of the datacontext.

Does anyone have any thoughts? Surely I dont have to go thru this every time I make a simple change? Is there a simple way of getting VWD in synch with itself? I welcome your replies.
 
Old January 28th, 2011, 04:50 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You could look at refactoring tools such as Resharper from JetBrains or Refactor! from Dev Express as these tools enable you rename something logically throughout a project. A few downsides: won't work with Express, they are commercial products, and they may not work directly with L2S diagrams (although you can rename your column through code first to update all references, and then manually update just the diagram).

You can also use Visual Studio's Refactor command. Right click the property name in some code block (e.g. where you're using something like myProduct.ProductNumber right-click on ProductNumber) and then choose Refactor | Rename. This will rename all occurrences for that class *except* the one in the .dbml file which you need to update manually. Not sure if this command is available in the Express edition.

Finally, you could have used Search and Replace. For something like ProductNumber this would have worked fine I think. But yes, you still need to be careful and make sure you're not renaming the wrong things. Once you get a bit more experienced in this renaming, you'll be able to do it in minutes, rather than hours.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
GeeTee991100 (January 28th, 2011)
 
Old January 28th, 2011, 01:30 PM
Authorized User
 
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Thanks for the reply





Similar Threads
Thread Thread Starter Forum Replies Last Post
throw/throws debasish Java Basics 2 April 27th, 2010 09:43 AM
throw an exception in catch Muyavil Java Basics 3 April 11th, 2009 10:56 PM
Synch 2 access databases raguapk Pro VB 6 2 December 11th, 2007 11:27 PM
Ch 2 pg 70: links throw error subgenius BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 August 16th, 2004 05:26 PM
TRY CATCH THROW question savoym C# 1 July 1st, 2004 03:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.