Categories
Development

Subsonic 3 – ActiveRecord – T4 tweak

Quick reminder : I’m using Subsonic 3 ActiveRecord on a MSSQL database.

One of the nice things with Subsonic 3 is to be able to generate your classes from the database fast and easy.

But sometimes when you are many working on the same project or when you work on different machines, it happens that your database doesnt have exactly the same name  as the original and the T4 files provided will not generate the parameters for your stored procedure.

A quick fix is to edit the method GetSPParams in SQLServer.ttinclude

Replace this line :

string[] restrictions = new string[4] { DatabaseName, null, spName, null };

With these

SqlConnectionStringBuilder connStringBuilder = new SqlConnectionStringBuilder(ConnectionString);
string[] restrictions = new string[4] { connStringBuilder.InitialCatalog, null, spName, null };

And then simply run your .tt files again.

Download the zip file containing the modified SQLServer.ttinclude

If you have improvements that you have made, feel free to write about them in the comment section.

Categories
Development

Subsonic 3 – ActiveRecord – Bug DateTime with default value

Tonight I just had the weirdest bug using Subsonic 3 and I just solved it, and if it can save you some time here is the solution for my case.

If you get this error :

System.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.) …

only on the saving operation for one particular table in your database. If the debugger in you find it strange, you’re not alone.

After searching, I found out that I forgot to initialize a datetime field (property) on one of my object.

When a datetime is not set in .Net, it sets the date to a minimum value. This is where the problem starts. That value is not within the acceptable range for a datetime type in Microsoft SQL Server (MSSQL).

Instead of giving a clear exception, the exception thrown is a transport-level error.

Hope it helps.

Good night.

 

Categories
Development

TortoiseSVN icons absent on windows 7

Some days ago I lost my icons indicating the status of the files in svn. I uninstalled TortoiseSVN and then installed again, unfortunaly still no luck at the end.

Today, I attacked the problem for a second time and actually found the solution on stackoverflow. Instead of copying it here, here is the link to get all the details on how to fix it : http://stackoverflow.com/questions/1057734/tortoisesvn-icons-not-showing-up-under-windows-7

Categories
Technical Support

Problem solving : Windows startup (related to memory)

Warning : If you have a problem with your computer and you’re at ease with computer hardware, you could attempt what is included within this article. However, please note that you are on your own, I will not be held responsible if it turns out bad.

A computer has been submitted to me on thursday for a problem at startup. (Windows 7, Core i7, 16GB RAM, SSD Hard Drive).

First possibility : Application thet gets in the way.

The first possibility that comes to mind is that an application is causing Windows to have troubles loading. Clearly it’s time to perform a clean boot. Here is the link how to achieve it, http://support.microsoft.com/kb/331796. It’s mostly about going in msconfig and go through a process of elimination to find the application or service that prevents windows to boot correctly. Under normal circumstances, if it starts in safe mode and all is running smoothly, it’s a good sign. Once the guilty software is identified and desactivated, it should be good now. Unfortunately here, it was not that simple.

Blue Screen Of Death shows up..

In this case, blue screen started to show up. Every time the message is about memory management. I start having doubts about the memory sticks. Computer might be new, it’s not a reason to rule it out. It’s time to test with memtest86+, http://www.memtest.org/. Results are clear, screen is red, memory has defects. I turn it off. I removed all memory sticks except one. I start memtest86+ and test again. Then I repeat the process with another stick until I find the bad stick. Bad stick is found. It’s now excluded. I put the good memory back in place. I power on. First step completed.

Corrupted OS

With the memory problems, some files must have been corrupted and the OS is corrupted. It refuses to boot.  I reinstall windows. With a SSD drive, there is no pain. Tuesday I will have the replacement for the stick and then back to the full 16GB of RAM. Sweet.
You

How would you have dealt with this problem ? I’m not a tech, I’m a developer, so I’m curious about all the possibilities.