August 2008 Entries
Take into consideration the following entity: public class CompositeType
{
public bool BoolValue { get; set; }
public string StringValue { get; set; }
public EnumType VehicleType { get; set; }
}
public enum EnumType
{
Car = 0,
...
Be very careful when you need to recreate your entities with Linq to SQL. If I added a new column to the table and I needed to refresh my entity I used to remove it from the design and re add it again. This has worked for a while until now when all of a sudden I started getting errors in my production environment. What happened? I used to have the property DeleteOnNull on an association and when I removed the associated entity to recreate it it also removed the association. When I added the entity back to the diagram...
I've been trying to be more green oriented for a while now. You can find some proof of that through my Tech Green Initiative posts here and here. Before, when I wasn't cautious about the environment, I used to throw my old batteries in the garbage. Now, that I am cautious about the environment, I know that batteries can leak and contaminate the earth. So I decided to do a simple search on how to dispose my batteries and found the Rechargeable Battery Recycling Corporation (RBRC) which will help you dispose your rechargeable batteries. They are partnered with many companies...
Both the Visual Studio 2008 and .NET Framework 3.5 Service Pack 1 are now available for download here and here respectively. They are really not a normal Service Pack as they not only fix bugs, but they also add a lot of new features that are not related to security. Please note that the Visual Studio 2008 SP1 includes the .NET Framework 3.5 SP1.
When you use DataReaders you have to check for DBNull.Value on every field that could have a possible null value to make sure you don't get an exception. Therefore your code ends up having a lot of these: if (dr["Colunm1"] != DBNull.Value)
SomeStringVariable = dr["Column1"].ToString();
//or using inline if
SomeStringVariable = (dr["Column1"] != DBNull.Value ? dr["Column1"].ToString() : String.Empty);
If dr("Column1") is DBNull.Value Then
...