/// <summary> /// Get the connection type model. /// </summary> /// <typeparam name="TDataModel">The data model type</typeparam> /// <typeparam name="TModel">The model type</typeparam> /// <param name="dataAccess">The data access instance.</param> /// <returns>The connection type model</returns> public static ConnectionTypeModel GetTypeModel <TDataModel, TModel>(ICommonDataGenericBase <TModel> dataAccess) where TModel : class, new() { ConnectionTypeModel connectionModel = new ConnectionTypeModel(); connectionModel.ConnectionDataType = dataAccess.ConnectionDataType; connectionModel.ConnectionType = dataAccess.ConnectionType; connectionModel.DataAccessProvider = dataAccess.DataAccessProvider.GetType().AssemblyQualifiedName; connectionModel.DatabaseConnection = dataAccess.ConfigurationDatabaseConnection; connectionModel.DataObjectTypeName = typeof(TDataModel).AssemblyQualifiedName; return(connectionModel); }
/// <summary> /// Default constructor /// </summary> /// <param name="dataAccess">The data access implementation</param> protected GenericDataAccess(ICommonDataGenericBase <T> dataAccess) { this.ConnectionTypeModel = Nequeo.Data.Operation.GetTypeModel <T, T>(dataAccess); this.OnLoad += new EventHandler(GenericDataAccess_OnLoad); this.OnUpdate += new EventHandler(GenericDataAccess_OnUpdate); this.OnInsert += new EventHandler(GenericDataAccess_OnInsert); this.OnDelete += new EventHandler(GenericDataAccess_OnDelete); this.OnLoadError += new EventHandler <Nequeo.Custom.MessageArgs>(GenericDataAccess_OnLoadError); this.OnUpdateError += new EventHandler <Nequeo.Custom.MessageArgs>(GenericDataAccess_OnUpdateError); this.OnInsertError += new EventHandler <Nequeo.Custom.MessageArgs>(GenericDataAccess_OnInsertError); this.OnDeleteError += new EventHandler <Nequeo.Custom.MessageArgs>(GenericDataAccess_OnDeleteError); this.OnTotalRecordsError += new EventHandler <Nequeo.Custom.MessageArgs>(GenericDataAccess_OnTotalRecordsError); this.OnBeforeLoad += new EventHandler <Nequeo.Custom.OperationArgs>(GenericDataAccess_OnBeforeLoad); this.OnBeforeUpdate += new EventHandler <Nequeo.Custom.OperationArgs>(GenericDataAccess_OnBeforeUpdate); this.OnBeforeInsert += new EventHandler <Nequeo.Custom.OperationArgs>(GenericDataAccess_OnBeforeInsert); this.OnBeforeDelete += new EventHandler <Nequeo.Custom.OperationArgs>(GenericDataAccess_OnBeforeDelete); }