n="justify"> {load (); save ();
} interface IUniversalSettings: ISettings
{ GetBase (); IsNull (); SetNull (); Clear (); Load (List _keys); Load ();
Параметр «_key»> ключ поіскаGetbykey (string _key); Setbykey (string _key, string value); Setbykey (string _section, string _key, string value); Count (); ModuleName {get; set;} SectionKeys {get; set; }
} interface ISectionKey
{Section {get; set; } Entry {get; set; } CompareTo (object obj);
}
}
{Модуль роботи з базою даних}
namespace avto.Data ??p>
{class BaseRepository: IBaseRepository
{IDbDataSource _db; IAppContext _appcontext; DataContext _datacontext; BaseRepository ()
{
_datacontext=null;
} BaseRepository (IDbDataSource dbDataSource, IAppContext appContext)
{. Assert (null!=dbDataSource);
_db=dbDataSource;
_datacontext=_db.Datacontext;
_appcontext=appContext;
} void SubmitChangesinDC ()
{
{
_datacontext.SubmitChanges ();
} (Exception ex)
{(); ex;
}
} void RefreshDataContext ()
{
_datacontext=_db.GetNewDataContext ();
} IQueryable GetAll () where T: class
{
{_datacontext.GetTable ();
} (Exception ex)
{
_appcontext.SysMsg.ReportMsg (ex.Message, avto.SysMsg.Interfaces.MsgType.Error);
} Queryable.AsQueryable (new List ());
} int GetAttributeOf (PropertyInfo propertyInfo)
{
{[] attributes=propertyInfo.GetCustomAttributes (typeof (ColumnAttribute), true); (attributes.Length == 0) - 1; (((ColumnAttribute) attributes [0]). IsPrimaryKey) 1 ; 0;
} (Exception ex)
{
_appcontext.SysMsg.ReportMsg (ex.Message, avto.SysMsg.Interfaces.MsgType.Error);
} - 1;
} bool IsPrimaryKey (PropertyInfo propertyInfo)
{
{(GetAttributeOf (propertyInfo) <1) return false; true;
} (Exception ex)
{
_appcontext.SysMsg.ReportMsg (ex.Message, avto.SysMsg.Interfaces.MsgType.Error);
} false;
} PropertyInfo GetPrimaryKey (Type entityType)
{
{(PropertyInfo property in entityType.GetProperties ())
{(IsPrimaryKey (property))
{(property.PropertyType!=typeof (int))
{new ApplicationException (string.Format («Primary key,« {0} », of type« {1} »is not int»...