public void TestInitialize() { CreateMappings(); _db = CreateSqlServerDB(); SeedDB(); MapRepository.Instance.EnableTraceLogging = true; }
public SearchClient(IBucketConfig bucketConfig, ClientConfiguration clientConfig, IDataMapper dataMapper, ILogger logger) { _bucketConfig = bucketConfig; _clientConfig = clientConfig; DataMapper = dataMapper; Log = logger; }
/// <summary> /// Builds the specified lazy load proxy for a concrete class with virtual method. /// </summary> /// <param name="dataMapper">The data mapper.</param> /// <param name="selectStatement">The mapped statement used to build the lazy loaded object.</param> /// <param name="param">The parameter object used to build lazy loaded object.</param> /// <param name="target">The target object which contains the property proxydied..</param> /// <param name="setAccessor">The proxified member accessor.</param> /// <returns>Return a proxy object</returns> public object CreateProxy( IDataMapper dataMapper, IMappedStatement selectStatement, object param, object target, ISetAccessor setAccessor) { Type typeProxified = setAccessor.MemberType; if (logger.IsDebugEnabled) { logger.Debug(string.Format("Statement '{0}', create proxy for member {1}.", selectStatement.Id, setAccessor.MemberType)); } // Build the proxy IInterceptor interceptor= new LazyLoadInterceptor(dataMapper, selectStatement, param, target, setAccessor); // if you want to proxy concrete classes, there are also 2 main requirements : // the class can not be sealed and only virtual methods can be intercepted. // The reason is that DynamicProxy will create a subclass of your class overriding all methods // so it can dispatch the invocations to the interceptor. // The proxified type must also have an empty constructor object generatedProxy = proxyGenerator.CreateClassProxy(typeProxified, Type.EmptyTypes, interceptor); return generatedProxy; }
private int[] GetUsedTags(string table, IDataMapper mapper) { return mapper.ExecuteReader($"SELECT DISTINCT Tags FROM {table} WHERE NOT Tags = '[]'", reader => reader.GetString(0)) .SelectMany(Json.Deserialize<List<int>>) .Distinct() .ToArray(); }
public static Dialect CreateDialect(IDataMapper dataMapper) { string providerString = dataMapper.ProviderFactory.ToString(); switch (providerString) { case DB_SqlClient: return new SqlServerDialect(); case DB_OracleDataAccessClient: return new OracleDialect(); case DB_SystemDataOracleClient: return new OracleDialect(); case DB_SqlCeClient: return new SqlServerCeDialect(); case DB_FireBirdClient: return new FirebirdDialect(); case DB_SQLiteClient: return new SqliteDialect(); default: return new Dialect(); } }
protected virtual void SetUpFixture() { string resource = "SqlMap_StatementOnly.config"; string scriptDirectory = Path.Combine(Path.Combine(Path.Combine(Resources.ApplicationBase, ".."), ".."), "Scripts") + Path.DirectorySeparatorChar; try { IConfigurationEngine engine = new DefaultConfigurationEngine(); engine.RegisterInterpreter(new XmlConfigurationInterpreter(resource)); engine.RegisterModule(new AccountModule()); engine.RegisterModule(new DocumentModule()); IMapperFactory mapperFactory = engine.BuildMapperFactory(); Console.WriteLine(engine.ConfigurationStore.ToString()); dataMapper = ((IDataMapperAccessor)mapperFactory).DataMapper; ISessionFactory sessionFactory = engine.ModelStore.SessionFactory; BaseTest.InitScript(sessionFactory.DataSource, scriptDirectory + "account-init.sql"); } catch (Exception ex) { Exception e = ex; while (e != null) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); e = e.InnerException; } throw; } }
public T ExecuteObject <T>(string sql, IDataMapper <T> dataMapper) { DbHelper dbHelper = new DbHelper(conn); logger.Write(Severity.Debug, "ExecuteObject() - " + sql); return(dbHelper.ExecuteObject(sql, dataMapper)); }
public CatalogMedioEnvioModel(IDataMapper dataMapper) { this._dataMapper = new MedioEnvioDataMapper(); this._medioEnvio = new FixupCollection <DeleteMedioEnvio>(); this._selectedMedioEnvio = new MEDIO_ENVIO(); //this._isChecked = false; this.loadItems(); }
public DapperRepository(IDbConnection connection, IDbTransaction transaction) { _connection = connection; _transaction = transaction; _expressionProvider = new SqlExpressionProvider(); _dataMapper = new DataMapper <TEntity>(); _tableName = typeof(TEntity).Name; }
public DisconnectedRepository(DisconnectedContext context) { _context = context; _tableName = typeof(TEntity).Name; _table = _context.DataSet.Tables[_tableName]; _dataMapper = new DataMapper <TEntity>(); _expressionProvider = new SqlExpressionProvider(); }
public FacturaCompraModel(IDataMapper dataMapper) { this._DataMapper = dataMapper as FacturaCompraDataMapper; this.FacturaDetalle = new ObservableCollection <FacturaCompraDetalleModel>(); this.IsNew = true; this.IsModified = false; this.HasNotRecibo = true; }
public CategoriaModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as CategoriaDataMapper) != null) { this._dataMapper = dataMapper as CategoriaDataMapper; } this.ActualUser = u; }
public DepartamentoModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as DepartamentoDataMapper) != null) { this._dataMapper = dataMapper as DepartamentoDataMapper; } this.ActualUser = u; }
public UsuarioModel(IDataMapper dataMapper) { if ((dataMapper as AppUsuario) != null) { this._dataMapper = dataMapper as AppUsuario; this._userRolDataMapper = dataMapper as AppUsuarioRol; } }
public CatalogAlmacenModel(IDataMapper dataMapper) { this._dataMapper = new AlmacenDataMapper(); this._almacen = new FixupCollection <DeleteAlmacen>(); this._tecnico = new FixupCollection <DeleteTecnico>(); //this._selectedAlmacen = new ALMACEN(); this.loadItems(); }
public ServicioModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as ServicioDataMapper) != null) { this._dataMapper = dataMapper as ServicioDataMapper; } this.ActualUser = u; }
public RedditClient(IClientConfiguration config, IDataMapper mapper, IPushShiftClient pushShiftClient) { _config = config ?? throw new ArgumentNullException(nameof(config)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _pushShiftClient = pushShiftClient ?? throw new ArgumentNullException(nameof(pushShiftClient)); _client = new Reddit(); }
public QueryClient(HttpClient httpClient, IDataMapper dataMapper, ClientConfiguration clientConfig, ConcurrentDictionary <string, QueryPlan> queryCache) { HttpClient = httpClient; DataMapper = dataMapper; _clientConfig = clientConfig; HttpClient.Timeout = new TimeSpan(0, 0, 0, (int)_clientConfig.QueryRequestTimeout); _queryCache = queryCache; }
public EpisodeStandardInternalDaoMapper( IDataMapper <InternalEpisodeCrew, MongoCrew> crewMapper, IDataMapper <InternalEpisodeGuest, MongoEpisodeGuest> guestMapper ) { _crewMapper = crewMapper; _guestMapper = guestMapper; }
public CatalogArticuloModel(IDataMapper dataMapper, CATEGORIA c) { this._dataMapper = new ArticuloDataMapper(); this._articulos = new FixupCollection <DeleteArticulo>(); //this._selectedarticulo = new DeleteArticulo(); this.loadItems(c); //this.loadItems(new ItemDataMapper()); }
public CatalogEmpresaModel(IDataMapper dataMapper) { this._dataMapper = new EmpresaDataMapper(); this._empresa = new FixupCollection <DeleteEmpresa>(); this._selectedEmpresa = new EMPRESA(); //this._isChecked = false; this.loadEmpresa(); }
public InsertTransporteModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as TransporteDataMapper) != null) { this._dataMapper = dataMapper as TransporteDataMapper; } this.ActualUser = u; }
public FileEntityService(IFileEntityRepository repository, IFileEntityManager fileEntityManager, IFileEntityExtensionManager fileEntityExtensionManager, IDataMapper dataMapper) : base(repository, dataMapper) { _fileEntityManager = fileEntityManager; _fileEntityExtensionManager = fileEntityExtensionManager; }
public SolicitanteModel(IDataMapper dataMapper) { if ((dataMapper as SolicitanteDataMapper) != null) { this._dataMapper = dataMapper as SolicitanteDataMapper; } this.ValideEmpresa = false; }
//private readonly IDbContextOptions<PolisContext> _context; public PolisEventListener(IDataMapper mapper, ICommandPublisher commandPublisher, IEventPublisher eventPublisher) { this.mapper = mapper; _commandPublisher = commandPublisher; _eventPublisher = eventPublisher; mapper.Print(); //_context = context; }
public CatalogProveedorModel(IDataMapper dataMapper) { this._dataMapper = new ProveedorDataMapper(); this._proveedor = new FixupCollection <DeleteProveedor>(); this._categoria = new FixupCollection <DeleteCategoria>(); //this._selectedProveedor = new PROVEEDOR(); this.loadItems(); }
public ArticuloModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as ArticuloDataMapper) != null) { this._dataMapper = dataMapper as ArticuloDataMapper; } this.ActualUser = u; }
public ProgramadoModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as ProgramadoDataMapper) != null) { this._dataMapper = dataMapper as ProgramadoDataMapper; } this.ActualUser = u; }
public PropiedadModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as PropiedadDataMapper) != null) { this._dataMapper = dataMapper as PropiedadDataMapper; } this.ActualUser = u; }
public MonedaModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as MonedaDataMapper) != null) { this._dataMapper = dataMapper as MonedaDataMapper; } this.ActualUser = u; }
public UserService(IUserRepository repository, IUserRoleRepository userRoleRepository, IDataMapper dataMapper) : base(repository, dataMapper) { _userRoleRepository = userRoleRepository; _repository = repository; }
public EpisodeStandardDtoInternalMapper( IDataMapper <EpisodeCrewDto, InternalEpisodeCrew> crewMapper, IDataMapper <EpisodeGuestDto, InternalEpisodeGuest> guestMapper ) { _crewMapper = crewMapper; _guestMapper = guestMapper; }
public TerminoEnvioModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as TerminoEnvioDataMapper) != null) { this._dataMapper = dataMapper as TerminoEnvioDataMapper; } this.ActualUser = u; }
public ClienteModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as ClienteDataMapper) != null) { this._dataMapper = dataMapper as ClienteDataMapper; } this.ActualUser = u; }
public TipoCotizacionModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as TipoCotizacionDataMapper) != null) { this._dataMapper = dataMapper as TipoCotizacionDataMapper; } this.ActualUser = u; }
public InfraestructuraModel(IDataMapper dataMapper, USUARIO u) { if ((dataMapper as InfraestructuraDataMapper) != null) { this._dataMapper = dataMapper as InfraestructuraDataMapper; } this.ActualUser = u; }
public MemcachedBucketManager(IBucket bucket, ClientConfiguration clientConfig, IDataMapper mapper, string username, string password) : base(bucket, clientConfig, mapper, new CouchbaseHttpClient(username, password), username, password) { }
internal ClusterManager(ClientConfiguration clientConfig, IServerConfig serverConfig, HttpClient httpClient, IDataMapper mapper, string username, string password) { _clientConfig = clientConfig; _serverConfig = serverConfig; Mapper = mapper; HttpClient = httpClient; _password = password; _username = username; }
internal BucketManager(string bucketName, ClientConfiguration clientConfig, HttpClient httpClient, IDataMapper mapper, string username, string password) { BucketName = bucketName; _clientConfig = clientConfig; Mapper = mapper; HttpClient = httpClient; _password = password; _username = username; }
/// <summary> /// Create a new proxy instance. /// </summary> /// <param name="dataMapper">The data mapper.</param> /// <param name="mappedStatement">The mapped statement.</param> /// <param name="param">The param.</param> /// <param name="target">The target.</param> /// <param name="setAccessor">The set accessor.</param> /// <returns>Returns a new proxy.</returns> public object CreateProxy( IDataMapper dataMapper, IMappedStatement mappedStatement, object param, object target, ISetAccessor setAccessor) { return new LazyList(dataMapper, mappedStatement, param, target, setAccessor); }
internal BucketManager(IBucket bucket, ClientConfiguration clientConfig, IDataMapper mapper, HttpClient httpClient, string username, string password) { _bucket = bucket; BucketName = bucket.Name; _clientConfig = clientConfig; Mapper = mapper; _password = password; _username = username; _httpClient = httpClient; }
internal BucketManager(IBucket bucket, ClientConfiguration clientConfig, HttpClient httpClient, IDataMapper mapper, string username, string password, ILogger logger) { Log = logger; _bucket = bucket; BucketName = bucket.Name; _clientConfig = clientConfig; Mapper = mapper; HttpClient = httpClient; _password = password; _username = username; }
/// <summary> /// Constructor for a lazy list loader /// </summary> /// <param name="dataMapper">The data mapper.</param> /// <param name="mappedSatement">The mapped statement used to build the list</param> /// <param name="param">The parameter object used to build the list</param> /// <param name="target">The target object which contains the property proxydied.</param> /// <param name="setAccessor">The proxified member accessor.</param> public LazyLoadInterceptor( IDataMapper dataMapper, IMappedStatement mappedSatement, object param, object target, ISetAccessor setAccessor) { this.param = param; statementName = mappedSatement.Id; this.dataMapper = dataMapper; this.target = target; this.setAccessor = setAccessor; }
internal ClusterManager(ClientConfiguration clientConfig, IServerConfig serverConfig, HttpClient httpClient, IDataMapper mapper, string username, string password, ILoggerFactory loggerFactory) { _loggerFactory = loggerFactory; Log = _loggerFactory.CreateLogger<ClusterManager>(); _clientConfig = clientConfig; _serverConfig = serverConfig; Mapper = mapper; HttpClient = httpClient; _password = password; _username = username; }
public SystemPeersDiscoveryService(ILogger logger, ICluster cluster, DiscoveryConfig config) { IDataMapperFactory mapper = new PocoDataMapperFactory(); _peerFactory = mapper.Create<DiscoveredPeer>(); _logger = logger; _cluster = cluster; _timer = new Timer(config.Interval * 1000); _timer.Elapsed += (s, e) => TryDiscover(); _timer.AutoReset = true; TryDiscover(); }
public void SetUpFixture() { string uri = "file://~/SqlMap.event.config"; IResource resource = ResourceLoaderRegistry.GetResource(uri); ConfigurationSetting setting = new ConfigurationSetting(); IConfigurationEngine engine = new DefaultConfigurationEngine(setting); engine.RegisterInterpreter(new XmlConfigurationInterpreter(resource)); engine.RegisterModule(new EventModule()); IMapperFactory mapperFactory = engine.BuildMapperFactory(); sessionFactory = engine.ModelStore.SessionFactory; dataMapper = ((IDataMapperAccessor)mapperFactory).DataMapper; }
protected virtual void SetUpFixture() { //DateTime start = DateTime.Now; configurationSetting = new ConfigurationSetting(); configurationSetting.Properties.Add("collection2Namespace", "MyBatis.DataMapper.SqlClient.Test.Domain.LineItemCollection2, MyBatis.DataMapper.SqlClient.Test"); configurationSetting.Properties.Add("nullableInt", "int?"); string resource = "sqlmap.config"; try { IConfigurationEngine engine = new DefaultConfigurationEngine(configurationSetting); engine.RegisterInterpreter(new XmlConfigurationInterpreter(resource)); engine.RegisterModule(new AliasModule()); IMapperFactory mapperFactory = engine.BuildMapperFactory(); sessionFactory = engine.ModelStore.SessionFactory; dataMapper = ((IDataMapperAccessor)mapperFactory).DataMapper; sessionStore = ((IModelStoreAccessor) dataMapper).ModelStore.SessionStore; } catch (Exception ex) { Exception e = ex; while (e != null) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); e = e.InnerException; } throw; } if (sessionFactory.DataSource.DbProvider.Id.IndexOf("PostgreSql") >= 0) { ConvertKey = new KeyConvert(Lower); } else if (sessionFactory.DataSource.DbProvider.Id.IndexOf("oracle") >= 0) { ConvertKey = new KeyConvert(Upper); } else { ConvertKey = new KeyConvert(Normal); } // string loadTime = DateTime.Now.Subtract(start).ToString(); // Console.WriteLine("Loading configuration time :"+loadTime); }
public static void Setup(TestContext testContext) { _connectionStringBuilder = new SqlConnectionStringBuilder { DataSource = "(local)", IntegratedSecurity = true, InitialCatalog = "Northwind" }; List<Type> bindMemberList = new List<Type> { typeof(BindFields), typeof(BindProperties) }; _builder = new Builder(_connectionStringBuilder, typeof(SingleSqlConnection), bindMemberList); _productDataMapper = _builder.Build<Product>(); _orderDataMapper = _builder.Build<Order>(); }
protected virtual void TestFixtureSetUp() { LogManager.Adapter = new ConsoleOutLoggerFA(new NameValueCollection()); configurationSetting = new ConfigurationSetting(); configurationSetting.Properties.Add("collection2Namespace", "MyBatis.DataMapper.Sqlite.Test.Domain.LineItemCollection2, MyBatis.DataMapper.Sqlite.Test"); configurationSetting.Properties.Add("nullableInt", "int?"); ConfigurationEngine = new DefaultConfigurationEngine(configurationSetting); ConfigurationEngine.RegisterInterpreter(new XmlConfigurationInterpreter("SqlMap.config")); ConfigurationEngine.RegisterModule(new AliasModule()); IMapperFactory mapperFactory = ConfigurationEngine.BuildMapperFactory(); sessionFactory = ConfigurationEngine.ModelStore.SessionFactory; dataMapper = ((IDataMapperAccessor)mapperFactory).DataMapper; }
public static void Setup(TestContext testContext) { _connectionStringBuilder = new SqlConnectionStringBuilder { DataSource = "(local)", IntegratedSecurity = true, InitialCatalog = "Northwind" }; List<Type> bindMemberList = new List<Type> { typeof(BindFields), typeof(BindProperties) }; _builder = new Builder(_connectionStringBuilder, typeof(MultiSqlConnection), bindMemberList); _customerDataMapper = _builder.Build<Customer>(); CleanToDefault(); }
/// <summary> /// Create a new proxy instance. /// </summary> /// <param name="dataMapper">The data mapper.</param> /// <param name="mappedStatement">The mapped statement.</param> /// <param name="param">The param.</param> /// <param name="target">The target.</param> /// <param name="setAccessor">The set accessor.</param> /// <returns>Returns a new proxy.</returns> public object CreateProxy( IDataMapper dataMapper, IMappedStatement mappedStatement, object param, object target, ISetAccessor setAccessor) { Type elementType = setAccessor.MemberType.GetGenericArguments()[0]; Type lazyType = typeof(LazyListGeneric<>); Type lazyGenericType = lazyType.MakeGenericType(elementType); Type[] parametersType = { typeof(IDataMapper), typeof(IMappedStatement), typeof(object), typeof(object), typeof(ISetAccessor) }; IFactory factory = mappedStatement.ModelStore.DataExchangeFactory.ObjectFactory.CreateFactory(lazyGenericType, parametersType); object[] parameters = { dataMapper, mappedStatement, param, target, setAccessor }; return factory.CreateInstance(parameters); }
public DataStoreManager(bool designMode, IScheduler mainThreadScheduler) { log.InfoFormat("DataStoreManager ctor"); m_MainThreadScheduler = mainThreadScheduler; if (!designMode) m_DataMapper = new DataMapper("metageta.db3"); else m_DataMapper = new MockDataMapper(); m_JobQueue = new JobQueue(designMode); m_DataMapper.Initialize(); m_DataStores.AddRange(m_DataMapper.GetDataStores(this)); OnDataStoresChanged(); }
public static IQuery CreateRowCountSelectQuery(TableCollection tables, IDataMapper dataMapper, string where, ISortQueryBuilder orderBy, bool useAltName) { SelectQuery innerQuery = (SelectQuery)CreateSelectQuery(tables, dataMapper, where, orderBy, useAltName); string providerString = dataMapper.ProviderFactory.ToString(); switch (providerString) { case DB_SqlClient: return new RowCountQueryDecorator(innerQuery); case DB_SqlCeClient: return new RowCountQueryDecorator(innerQuery); case DB_SQLiteClient: return new SqliteRowCountQueryDecorator(innerQuery); default: throw new NotSupportedException("Row count is not currently supported for this provider."); } }
public static IQuery CreatePagingSelectQuery(TableCollection tables, IDataMapper dataMapper, string where, ISortQueryBuilder orderBy, bool useAltName, int skip, int take) { SelectQuery innerQuery = (SelectQuery)CreateSelectQuery(tables, dataMapper, where, orderBy, useAltName); string providerString = dataMapper.ProviderFactory.ToString(); switch (providerString) { case DB_SqlClient: return new PagingQueryDecorator(innerQuery, skip, take); case DB_SqlCeClient: return new PagingQueryDecorator(innerQuery, skip, take); case DB_SQLiteClient: return new SqlitePagingQueryDecorator(innerQuery, skip, take); default: throw new NotImplementedException("Paging has not yet been implemented for this provider."); } }
/// <summary> /// Connects an existing unit of work to a <see cref="IDataMapper"/> which lifecycle control is out of scope. /// </summary> public void ConnectToSharedMapper(IDataMapper mapper) { this.mapper = mapper; GC.SuppressFinalize(this); }
protected UnitOfWork(IDataMapper mapper) : this() { this.mapper = mapper; }
public static void StartThread(IDataMapper dataMapper, Hashtable results, string statementName) { TestCacheThread tct = new TestCacheThread(dataMapper, results, statementName); Thread thread = new Thread( new ThreadStart(tct.Run) ); thread.Start(); try { thread.Join(); } catch (Exception e) { throw e; } }
public TestCacheThread(IDataMapper dataMapper, Hashtable results, string statementName) { this.dataMapper = dataMapper; this.results = results; this.statementName = statementName; }
public Webhooks(IClient client, IRequestSender requestSender, IDataMapper dataMapper) { this.client = client; this.requestSender = requestSender; this.dataMapper = dataMapper; }
/// <summary> /// Initializes a new instance of the <see cref="Catalog"/> class. /// </summary> /// <param name="dataMapper">The data mapper.</param> public Catalog(IDataMapper dataMapper) { this.dataMapper = dataMapper; }