Here’s how to regenerate your DBML code in Visual Studio 2010 when one of your database objects changes:
1. Remove the table
2. Close the DBML designer and save
3. Re-open the DBML designer
4. Re-add the object by dragging from Server Explorer
5. Close the DBML designer and save
In finding this solution, I did find some wailing and gnashing of teeth on-line, with people expecting the DBML code to have some kind of refresh feature for automatically doing this when the database changed.
I must admit I don’t share their chagrin. I am:
* Pathetically grateful for anything that saves me not having to write a hundred lines of property let/get statements
* Impressed by the way projects that reference these objects automatically re-test for compilation as soon as you save the DBML code
How to see if ‘foo’ is a unique entry in comma-separated list ‘foo,bar,foobar,foo,foo’?
We want to match the ‘foo’ at the beginning, at the end, and also in the middle, but not as part of the word ‘foobar.’ Also the comma-separated list might only be ‘foo’.
Plain wrong, because ^ means something different inside a set
Works, but clunky.
Works perfectly. Especially when you remember to escape the ” in your .NET string assignment 🙁
Thanks to the Rad Software Regular Expression Designer too!
The shine is starting to wear off Visual Studio 2010 Professional for me. Recently the IDE has started to hang, in a rather strange way. The code editor still appears to respond to mouse events, but nothing actually happens. E.g. you can highlight some code, right mouse click and choose copy from the context menu, but then when you come to paste, nothing happens. Or you’ve been coding away, and you see the file name has an asterisk against it, so you hit ‘Control+S’ to save, but nothing happens. And the only way you can save your changes is by closing the file – at this point VS prompts you if you want to save.
This seems to be something that others have noticed, certainly in the Beta:
One of the tips is to uncheck the ‘Enable the Visual Studio hosting process’ checkbox in Project Properties > Debug pane – and this seems to have fixed it for me.
This is not very impressive. I’ve used all of the previous .NET editions of Visual Studio, and never seen this kind of stuff before.
Turns out that the DevExpress installer does not integrate DXGrid with Express editions of Visual Studio. Solution is:
1.Manually add references for following assemblies:
2. Manually add namespace to XAML:
You can then add your
element as usual.
DevExpress Support also say that you can manually add the following assemblies to the Toolbox to achieve designer support, but that didn’t work for me:
C:Program FilesDevExpress 2009.2ComponentsSourcesDevExpress.DLLDevExpress.Wpf.Editors.v9.2.dll
C:Program FilesDevExpress 2009.2ComponentsSourcesDevExpress.DLLDevExpress.Wpf.Grid.v9.2.dll
When you on a solution with several assmblies in .NET, you’ll find yourself maintaining multiple copies of AssemlyInfo.cs, each of which contain a lot of common attributes such as:
You may also wish to make
AssemblyVersion uniform accross your build.
A useful technique in this situation is the following:
1. Copy the common attributes out into a new file, called something like ‘GlobalAssemblyInfo.cs’
2. Delete these common attributes from the original AssemblyInfo.cs files
3. Save your GlobalAssemblyInfo.cs file somewhere useful, e.g. in the same folder as your solution file
4. In each project, add GlobalAssmblyInfo.cs through the IDE as a linked file, rather than a straight addition.
Just started using these in a large project I am maintaining – very useful for working with event sinks that get called every time *anything* happens.
School boy error for the day was thinking in VB rather than C# for my loop condition: ‘i=6’ has changed rather than ‘i==6’ has changed
Assignment never changes, as I found, waiting in vain for my debug window to appear!
Today I was tormented by the following error from IIS:
HTTP 403.1 Forbidden: Execute Access Forbidden
I checked the directory security permissions in Windows, gave everyone under the sun god-like permissions on the whole folder tree, checked anonymous authentication, checked the server logs … but still this error came.
It turns out it was because I had “.com” in the folder nameÂ – something it would have taken a couple of months to figure out without Google:
Forum post on Velocity Reviews (new window)
Just hit an interesting problem with the replacement argument of Regex.Replace. The issue was that I was passing in variable content to this argument, and it turned out thatÂ dollar signs could occur in the content I was passing in. These were interpreted as backreferences, which gave me very different results to the ones I was expecting.
With hindsight, this is kind of obvious, and the solution is simply to replace any single dollar signs in the variable content with repeated dollar signs, as described here:
MSDN on Replacement Substitutions (new window)
See if you can spot any whiff of this looking at the documentation for the method though:
MSDN on Regex.Replace(String, String, String, RegexOptions) (new window)
Is being discussed at work. Interesting criticism here of the basic approach:
Whenever I read this kind of thing, it always leaves me with a lot of respect for security professionals – I just don’t have this instinct for trouble.