public T CreateDefault() { T item = new T(); foreach (var p in typeof(T).GetProperties()) { Type colType = p.PropertyType; if (colType == typeof(Nullable<DateTime>)) { p.SetValue(item, DateTime.Now, null); } else if (colType.IsGenericType && colType.GetGenericTypeDefinition() == typeof(Nullable<>)) { var t = Nullable.GetUnderlyingType(colType); p.SetValue(item, Activator.CreateInstance(t), null); } } return item; }