Nettiers.AdventureWorks.Entities.EntityUtil.InitEntityDateTimeValues C# (CSharp) Method

InitEntityDateTimeValues() public static method

Initializes the properties specified in propertyNames with the value of DateTime.Now for the specified entity.
public static InitEntityDateTimeValues ( Object entity ) : void
entity Object The instance of an object to set the properties on.
return void
		public static void InitEntityDateTimeValues(Object entity, params String[] propertyNames)
		{
			if ( entity != null && propertyNames != null )
			{
				PropertyInfo prop;

				foreach ( String name in propertyNames )
				{
					prop = GetProperty(entity, name);

					if ( prop != null && prop.CanWrite && prop.PropertyType.IsAssignableFrom(typeof(DateTime)) )
					{
					   	prop.SetValue(entity, DateTime.Now, null);			   					   
					}
				}
			}
		}