/// <summary>Gets a data provider instance for the specified entity type.</summary> public virtual IDataProvider GetProvider(Type type) { IDataProvider result = null; if (type == typeof(Domain.Administrator)) { result = new AdministratorDataProvider(); } else if (type == typeof(Domain.User)) { result = new UserDataProvider(); } else if (type == typeof(Domain.ApplicationEvent)) { result = new ApplicationEventDataProvider(); } else if (type == typeof(Domain.PasswordResetTicket)) { result = new PasswordResetTicketDataProvider(); } else if (type == typeof(Domain.LogonFailure)) { result = new LogonFailureDataProvider(); } else if (type == typeof(Domain.ContentBlock)) { result = new ContentBlockDataProvider(); } else if (type == typeof(Domain.Settings)) { result = new SettingsDataProvider(); } else if (type.IsInterface) { result = new InterfaceDataProvider(type); } if (result == null) { throw new NotSupportedException(type + " is not a data-supported type."); } else if (this.ConnectionString.HasValue()) { result.ConnectionString = this.ConnectionString; } else if (this.ConnectionStringKey.HasValue()) { result.ConnectionStringKey = this.ConnectionStringKey; } return(result); }
/// <summary>Loads the data from the specified data reader on the specified Administrator instance.</summary> internal static void FillData(IDataReader reader, Domain.Administrator entity, UserFields fields) { var values = new object[reader.FieldCount]; reader.GetValues(values); UserDataProvider.FillData(reader, entity, fields); if (values[fields.Administrators_ImpersonationToken] != DBNull.Value) { entity.ImpersonationToken = values[fields.Administrators_ImpersonationToken] as string; } }