2006-11-14 14:33:33 +00:00

805 lines
25 KiB
C#

// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
using System.Configuration;
using System.IO;
namespace Volian.CSLA.Library
{
/// <summary>
/// Section Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Section : BusinessBase<Section>
{
#region Business Methods
private string _errorMessage = string.Empty;
public string ErrorMessage
{
get { return _errorMessage; }
}
private static int _nextSectID = -1;
public static int NextSectID
{
get { return _nextSectID--; }
}
private int _SectID;
[System.ComponentModel.DataObjectField(true, true)]
public int SectID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _SectID;
}
}
private string _Number = string.Empty;
public string Number
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _Number;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_Number != value)
{
_Number = value;
PropertyHasChanged();
}
}
}
private string _Title = string.Empty;
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _Title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_Title != value)
{
_Title = value;
PropertyHasChanged();
}
}
}
private byte _ContentType;
/// <summary>
/// 0 Nothing, 1 Structure, 2 Document
/// </summary>
public byte ContentType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ContentType;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_ContentType != value)
{
_ContentType = value;
PropertyHasChanged();
}
}
}
private int _ContentID;
public int ContentID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ContentID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_ContentID != value)
{
_ContentID = value;
PropertyHasChanged();
}
}
}
private string _Format = string.Empty;
public string Format
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _Format;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_Format != value)
{
_Format = value;
PropertyHasChanged();
}
}
}
private string _Config = string.Empty;
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _Config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_Config != value)
{
_Config = value;
PropertyHasChanged();
}
}
}
private DateTime _DTS = new DateTime();
public DateTime DTS
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _DTS;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_DTS != value)
{
_DTS = value;
PropertyHasChanged();
}
}
}
private string _UserID = string.Empty;
public string UserID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _UserID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_UserID != value)
{
_UserID = value;
PropertyHasChanged();
}
}
}
private byte[] _LastChanged = new byte[8];//timestamp
// TODO: Replace base Section.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Section</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Section.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Section</returns>
protected override object GetIdValue()
{
return _SectID;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Number", 30));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Title", 510));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Format", 2048));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "UserID");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(SectID, "<Role(s)>");
//AuthorizationRules.AllowRead(Number, "<Role(s)>");
//AuthorizationRules.AllowRead(Title, "<Role(s)>");
//AuthorizationRules.AllowRead(ContentType, "<Role(s)>");
//AuthorizationRules.AllowRead(ContentID, "<Role(s)>");
//AuthorizationRules.AllowRead(Format, "<Role(s)>");
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
//AuthorizationRules.AllowWrite(Number, "<Role(s)>");
//AuthorizationRules.AllowWrite(Title, "<Role(s)>");
//AuthorizationRules.AllowWrite(ContentType, "<Role(s)>");
//AuthorizationRules.AllowWrite(ContentID, "<Role(s)>");
//AuthorizationRules.AllowWrite(Format, "<Role(s)>");
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
public int CurrentEditLevel
{ get { return EditLevel; } }
private Section()
{/* require use of factory methods */}
public static Section New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Section");
return DataPortal.Create<Section>();
}
public static Section New(string number, string title, byte contentType, int contentID, string format, string config)
{
Section tmp = Section.New();
tmp.Number = number;
tmp.Title = title;
tmp.ContentType = contentType;
tmp.ContentID = contentID;
tmp.Format = format;
tmp.Config = config;
return tmp;
}
public static Section MakeSection(string number, string title, byte contentType, int contentID, string format, string config)
{
Section tmp = Section.New(number, title, contentType, contentID, format, config);
tmp.Save();
return tmp;
}
public static Section MakeSection(string number, string title, byte contentType, int contentID, string format, string config, DateTime dts, string userID)
{
Section tmp = Section.New(number, title, contentType, contentID, format, config);
if (dts >= new DateTime(1753, 1, 1) && dts <= new DateTime(9999, 12, 31)) tmp.DTS = dts;
if (userID != null && userID != string.Empty) tmp.UserID = userID;
tmp.Save();
return tmp;
}
public static Section Get(int sectID)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Section");
return DataPortal.Fetch<Section>(new PKCriteria(sectID));
}
public static Section Get(SafeDataReader dr)
{
if (dr.Read()) return new Section(dr);
return null;
}
private Section(SafeDataReader dr)
{
_SectID = dr.GetInt32("SectID");
_Number = dr.GetString("Number");
_Title = dr.GetString("Title");
_ContentType = dr.GetByte("ContentType");
_ContentID = dr.GetInt32("ContentID");
_Format = dr.GetString("Format");
_Config = dr.GetString("Config");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
}
public static void Delete(int sectID)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Section");
DataPortal.Delete(new PKCriteria(sectID));
}
public override Section Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Section");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Section");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Section");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _SectID;
public int SectID
{ get { return _SectID; } }
public PKCriteria(int sectID)
{
_SectID = sectID;
}
}
// TODO: If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
_SectID = NextSectID;
// Database Defaults
_ContentType = ext.DefaultContentType;
_ContentID = ext.DefaultContentID;
_DTS = ext.DefaultDTS;
_UserID = ext.DefaultUserID;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getSection";
cm.Parameters.AddWithValue("@SectID", criteria.SectID);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_SectID = dr.GetInt32("SectID");
_Number = dr.GetString("Number");
_Title = dr.GetString("Title");
_ContentType = dr.GetByte("ContentType");
_ContentID = dr.GetInt32("ContentID");
_Format = dr.GetString("Format");
_Config = dr.GetString("Config");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
}
}
}
}
catch (Exception ex)
{
Database.LogException("Section.DataPortal_Fetch", ex);
_errorMessage = ex.Message;
throw new DbCslaException("Section.DataPortal_Fetch", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addSection";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@Number", _Number);
cm.Parameters.AddWithValue("@Title", _Title);
cm.Parameters.AddWithValue("@ContentType", _ContentType);
cm.Parameters.AddWithValue("@ContentID", _ContentID);
cm.Parameters.AddWithValue("@Format", _Format);
cm.Parameters.AddWithValue("@Config", _Config);
cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
// Output Calculated Columns
SqlParameter param_SectID = new SqlParameter("@newSectID", SqlDbType.Int);
param_SectID.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_SectID);
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_SectID = (int)cm.Parameters["@newSectID"].Value;
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
}
}
catch (Exception ex)
{
Database.LogException("Section.DataPortal_Insert", ex);
_errorMessage = ex.Message;
throw new DbCslaException("Section.DataPortal_Fetch", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn, ref int sectID, string number, string title, byte contentType, int contentID, string format, string config, DateTime dts, string userID)
{
try
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addSection";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@Number", number);
cm.Parameters.AddWithValue("@Title", title);
cm.Parameters.AddWithValue("@ContentType", contentType);
cm.Parameters.AddWithValue("@ContentID", contentID);
cm.Parameters.AddWithValue("@Format", format);
cm.Parameters.AddWithValue("@Config", config);
cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
// Output Calculated Columns
SqlParameter param_SectID = new SqlParameter("@newSectID", SqlDbType.Int);
param_SectID.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_SectID);
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
sectID = (int)cm.Parameters["@newSectID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch (Exception ex)
{
Database.LogException("Section.Add", ex);
throw new DbCslaException("Section.Add", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if (base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateSection";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@SectID", _SectID);
cm.Parameters.AddWithValue("@Number", _Number);
cm.Parameters.AddWithValue("@Title", _Title);
cm.Parameters.AddWithValue("@ContentType", _ContentType);
cm.Parameters.AddWithValue("@ContentID", _ContentID);
cm.Parameters.AddWithValue("@Format", _Format);
cm.Parameters.AddWithValue("@Config", _Config);
cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
cm.Parameters.AddWithValue("@LastChanged", _LastChanged);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
}
}
catch (Exception ex)
{
Database.LogException("Section.DataPortal_Update", ex);
_errorMessage = ex.Message;
if (!ex.Message.EndsWith("has been edited by another user."))throw ex;
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn, ref int sectID, string number, string title, byte contentType, int contentID, string format, string config, DateTime dts, string userID, ref byte[] lastChanged)
{
try
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateSection";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@SectID", sectID);
cm.Parameters.AddWithValue("@Number", number);
cm.Parameters.AddWithValue("@Title", title);
cm.Parameters.AddWithValue("@ContentType", contentType);
cm.Parameters.AddWithValue("@ContentID", contentID);
cm.Parameters.AddWithValue("@Format", format);
cm.Parameters.AddWithValue("@Config", config);
cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
cm.Parameters.AddWithValue("@LastChanged", lastChanged);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch (Exception ex)
{
Database.LogException("Section.Update", ex);
throw new DbCslaException("Section.Update", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_SectID));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteSection";
cm.Parameters.AddWithValue("@SectID", criteria.SectID);
cm.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
Database.LogException("Section.DataPortal_Delete", ex);
_errorMessage = ex.Message;
throw new DbCslaException("Section.DataPortal_Delete", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn, int sectID)
{
try
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteSection";
// Input PK Fields
cm.Parameters.AddWithValue("@SectID", sectID);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch (Exception ex)
{
Database.LogException("Section.Remove", ex);
throw new DbCslaException("Section.Remove", ex);
}
}
#endregion
#region Exists
public static bool Exists(int sectID)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(sectID));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _SectID;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int sectID)
{
_SectID = sectID;
}
protected override void DataPortal_Execute()
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsSection";
cm.Parameters.AddWithValue("@SectID", _SectID);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch (Exception ex)
{
Database.LogException("Section.DataPortal_Execute", ex);
throw new DbCslaException("Section.DataPortal_Execute", ex);
}
}
}
#endregion
// Standard Default Code
#region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual byte DefaultContentType
{
get { return 0; }
}
public virtual int DefaultContentID
{
get { return 0; }
}
public virtual DateTime DefaultDTS
{
get { return DateTime.Now; }
}
public virtual string DefaultUserID
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
#endregion
} // Class
} // Namespace
//// The following is a sample Extension File. You can use it to create SectionExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace Volian.CSLA.Library
//{
// public partial class Section
// {
// partial class Extension : extensionBase
// {
// // TODO: Override automatic defaults
// public virtual byte DefaultContentType
// {
// get { return 0; }
// }
// public virtual int DefaultContentID
// {
// get { return 0; }
// }
// public virtual DateTime DefaultDTS
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUserID
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}