public void SetUp() { _mockRepository = new MockRepository(); _simpleDbProxy = _mockRepository.StrictMock<ISimpleDbProxy>(); _entityMapper = _mockRepository.StrictMock<IEntityMapper>(); _formEventRepository = new FormEventRepository(_simpleDbProxy, _entityMapper); }
public TrackingController(IFormEventTrackingService formEventTrackingService, IPageEventTrackingService pageEventTrackingService, IEntityMapper entityMapper) { _formEventTrackingService = formEventTrackingService; _pageEventTrackingService = pageEventTrackingService; _entityMapper = entityMapper; }
public SvnCommitProvider(IEntityMapper mapper, IValidator validator) { MaxCountOfCommits = 30; MaxRepositoryDiscoverDepth = 1000; _mapper = mapper; _validator = validator; }
public void SetUp() { _mockRepository = new MockRepository(); _formEventTrackingService = _mockRepository.StrictMock<IFormEventTrackingService>(); _pageEventTrackingService = _mockRepository.StrictMock<IPageEventTrackingService>(); _entityMapper = _mockRepository.StrictMock<IEntityMapper>(); _trackingController = new TrackingController(_formEventTrackingService, _pageEventTrackingService, _entityMapper); }
public QueryVisitor(IEntityMapper mapper, WhereVisitor whereVisitor, ProjectorVisitor projectorVisitor) { this.mapper = mapper; this.whereVisitor = whereVisitor; this.projectorVisitor = projectorVisitor; //TODO: Refactoring this.whereVisitor.Mapper = mapper; this.projectorVisitor.Mapper = mapper; }
public CommandBuilder(IEntityMapper mapper) { if (mapper == null) throw new ArgumentNullException("mapper"); _mapper = mapper; _tableName = mapper.TableName; foreach (var property in mapper.Properties.Values) { if (property.IsPrimaryKey) _keys.Add(property); else _values.Add(property); } }
public OrderByToken(MethodCallExpression expression, IEntityMapper mapper, bool descending) : base(expression, mapper) { Descending = descending; }
public static void RegisterMapper(Type t, IEntityMapper modifications) { Registry[t] = modifications; }
public DeskFinder(IEntityMapper <Desk, DeskResult> mapper, string currentUserName) : this(System.Enum.GetName(typeof(EnvironmentDataCode), EnvironmentDataCode.ProtDB), mapper, currentUserName) { InitializeProperty(); }
public DeskApprovalEndorsementFinder(string dbName, IEntityMapper <Desk, DeskEndorsement> mapper) : base(dbName, mapper) { VersionFilters = new Dictionary <Guid, decimal>(); }
public UnaryToken(UnaryExpression expression, IEntityMapper mapper) : base(expression, mapper) { }
public void SetUp() { _mockRepository = new MockRepository(); _mongoDbProxy = _mockRepository.StrictMock<IMongoDbProxy>(); _entityMapper = _mockRepository.StrictMock<IEntityMapper>(); }
/// <summary> /// Initialize /// </summary> /// <param name="session"></param> /// <param name="sql"></param> /// <param name="provided"></param> public Query(Session session, string sql, IEntityMapper <T> provided) : base(session, sql) { _mapper = EnsureMapper(provided); }
public AdventureWorksDbContext(IOptions <AppSettings> appSettings, IEntityMapper entityMapper) { ConnectionString = appSettings.Value.ConnectionString; EntityMapper = entityMapper; }
/// <summary> /// Initializes a new instance of the <see cref="EfDbArgs{T, TModel}"/> class with a <paramref name="mapper"/> and <paramref name="paging"/>. /// </summary> /// <param name="mapper">The <see cref="IEntityMapper{T, TModel}"/>.</param> /// <param name="paging">The <see cref="PagingArgs"/>.</param> /// <param name="dbContext">The <see cref="Microsoft.EntityFrameworkCore.DbContext"/> where overridding automatic default.</param> public EfDbArgs(IEntityMapper <T, TModel> mapper, PagingArgs paging, DbContext?dbContext = null) : this(mapper, new PagingResult(paging ?? throw new ArgumentNullException(nameof(paging))), dbContext)
/// <summary> /// Initializes a new instance of the <see cref="EfDbArgs{T, TModel}"/> class with a <paramref name="mapper"/>. /// </summary> /// <param name="mapper">The <see cref="IEntityMapper{T, TModel}"/>.</param> /// <param name="dbContext">The <see cref="Microsoft.EntityFrameworkCore.DbContext"/> where overridding automatic default.</param> public EfDbArgs(IEntityMapper <T, TModel> mapper, DbContext?dbContext = null) { Mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); DbContext = dbContext; }
/// <summary> /// Initializes a new instance of the <see cref="ControllerHandler"/> class. /// </summary> /// <param name="controllerType">Type of the controller.</param> protected internal ControllerHandler(Application application, ControllerDescriptor descriptor, ILogger logger) { this.descriptor = descriptor; this.logger = logger; this.application = application; controllerConstructor = descriptor.ControllerType.GetConstructor(Type.EmptyTypes); foreach (ControllerDescriptor.BindPointDescriptor bindPoint in descriptor.Targets) manipulatedFields.AddRange(bindPoint.ParameterFields.Values); manipulatedFields.AddRange(descriptor.FormFields.Values); manipulatedFields.AddRange(descriptor.RequestFields.Values); manipulatedFields.AddRange(descriptor.SessionFields.Values); foreach (ControllerDescriptor.CookieFieldDescriptor cookieField in descriptor.CookieFields.Values) manipulatedFields.Add(cookieField.Field); manipulatedFields.ForEach( (mbr) => { // var attributes = mbr.GetCustomAttributes(typeof(FormatAsAttribute), false) as FormatAsAttribute[]; var attributes = mbr.GetCustomAttributes(typeof(FormatAsAttribute), false).ToArray(); if (attributes.Length != 1) return; formatters.Add(mbr, application.FormatManagerFactory.GetManagerInstance().GetFormatterByFormat(attributes[0].Properties["FormatName"].AsString())); } ); var mapperAttribute = descriptor.ControllerType.GetCustomAttributes(typeof (MapsWithAttribute), false) as MapsWithAttribute[]; if (mapperAttribute != null && mapperAttribute.Length == 1) mapper = Activator.CreateInstance(mapperAttribute[0].MapperType) as IEntityMapper; }
public DeskRoleUserFinder(string dbName, IEntityMapper <DeskRoleUser, DeskRoleUser> mapper) : base(dbName, mapper) { }
public EntityNavigationCollectionSerializer(string foreignKey, IEntityMapper entityMapper) { ForeignKey = foreignKey; ForeignPropertyMap = entityMapper.GetEntityMapping().Where(m => m.Property.Name == foreignKey).FirstOrDefault(); EntityMapper = entityMapper; }
public DefaultSqlGenerater(IEntityMapper mapper, ISqlAdapter sqlAdapter) { _mapper = mapper; _sqlAdapter = sqlAdapter; }
/// <summary> /// Initializes a new instance of the <see cref="ODataArgs{T, TModel}"/> class with a <paramref name="mapper"/>. /// </summary> /// <param name="mapper">The <see cref="IEntityMapper{T, TModel}"/>.</param> /// <param name="collectionName">The entity collection name where overridding default.</param> public ODataArgs(IEntityMapper <T, TModel> mapper, string?collectionName = null) { Mapper = Check.NotNull(mapper, nameof(mapper)); CollectionName = collectionName; }
public PlayerGameController(PlayerGameRepository playergameRepository, IEntityMapper <PlayerGame, PlayerGameViewModel> entityToVmMapper, IEntityMapper <PlayerGameViewModel, PlayerGame> vmToEntityMapper) { this.playergameRepository = playergameRepository; this.entityToVmMapper = entityToVmMapper; this.vmToEntityMapper = vmToEntityMapper; }
/// <summary> /// Initializes a new instance of the <see cref="ODataArgs{T, TModel}"/> class. /// </summary> /// <param name="mapper">The <see cref="IEntityMapper{T, TModel}"/>.</param> /// <param name="paging">The <see cref="PagingResult"/>.</param> /// <param name="collectionName">The entity collection name where overridding default.</param> public ODataArgs(IEntityMapper <T, TModel> mapper, PagingResult paging, string?collectionName = null) : this(mapper, collectionName) { Paging = Check.NotNull(paging, nameof(paging)); }
public AutoNewsContext(DbContextOptions <AutoNewsContext> options, IEntityMapper entityMapper) : base(options) { _EntityMapper = entityMapper; }
public CrudService(IBaseRepository <TEntity> baseRepository, IEntityMapper mapper) { this.baseRepository = baseRepository; this.mapper = mapper; }
public DeskApprovalEndorsementFinder(IEntityMapper <Desk, DeskEndorsement> mapper) : this(System.Enum.GetName(typeof(EnvironmentDataCode), EnvironmentDataCode.ProtDB), mapper) { }
internal static string GetRelevanceAlias(IEntityMapper <T> mpper) { return(string.Join("|", from t in mpper.Relevances select t.AliaName)); }
public CheckNotificationService(ISystemClock systemClock, Entities.CheckContext context, IEntityMapper entityMapper) { _systemClock = systemClock; _context = context; _entityMapper = entityMapper; }
/// <summary> /// Maps the next object from Dapper. /// </summary> /// <typeparam name="TItemType">The item type to be mapped.</typeparam> /// <param name="context">The context used to map object from Dapper.</param> /// <param name="fieldNames">The names of one or more GraphQL fields associated with the item.</param> /// <param name="entityMapper">An optional entity mapper. This is used to map complex objects from Dapper mapping results.</param> /// <returns>The mapped item.</returns> public TItemType Next <TItemType>( IEnumerable <string> fieldNames, Func <IDictionary <string, Field>, IHaveSelectionSet, IHaveSelectionSet> getSelectionSet, IEntityMapper <TItemType> entityMapper = null) where TItemType : class { if (fieldNames == null) { throw new ArgumentNullException(nameof(fieldNames)); } if (ItemEnumerator == null || SplitOnEnumerator == null) { throw new NotSupportedException("Cannot call Next() before calling Start()"); } lock (LockObject) { var keys = fieldNames.Intersect(CurrentSelectionSet.Keys); if (keys.Any()) { TItemType item = default(TItemType); while ( ItemEnumerator.MoveNext() && SplitOnEnumerator.MoveNext()) { // Whether a non-null object exists at this position or not, // the SplitOn is expecting this type here, so we will yield it. if (SplitOnEnumerator.Current == typeof(TItemType)) { item = ItemEnumerator.Current as TItemType; break; } } if (entityMapper != null) { // Determine where the next entity mapper will get its selection set from IHaveSelectionSet selectionSet = getSelectionSet(CurrentSelectionSet, SelectionSet); var nextContext = new EntityMapContext { Items = Items.Skip(MappedCount), SelectionSet = selectionSet, SplitOn = SplitOn.Skip(MappedCount), }; using (nextContext) { item = entityMapper.Map(nextContext); // Update enumerators to skip past items already mapped var mappedCount = nextContext.MappedCount; MappedCount += nextContext.MappedCount; int i = 0; while ( // Less 1, the next time we iterate we // will advance by 1 as part of the iteration. i < mappedCount - 1 && ItemEnumerator.MoveNext() && SplitOnEnumerator.MoveNext()) { i++; } } } else { MappedCount++; } return(item); } } return(default(TItemType)); }
public ExecuteQuerySqlStatement(IStatementExecutor commandExecutor, IEntityMapper entityMapper) : base(commandExecutor) { this.entityMapper = entityMapper; }
/// <summary> /// Initializes a new instance of the <see cref="SqlClientRepository{TModel,TEntity}"/> class. /// </summary> /// <param name="repositoryProvider"> /// The repository provider. /// </param> /// <param name="entityMapper"> /// The entity mapper. /// </param> public SqlClientRepository(IRepositoryProvider repositoryProvider, IEntityMapper entityMapper) : base(repositoryProvider, entityMapper) { }
public OrderByToken(MethodCallExpression expression, IEntityMapper mapper) : this(expression, mapper, descending : false) { }
public PlayerController(PlayerRepository playerRepository, IEntityMapper <Player, PlayerViewModel> entityToVmMapper, IEntityMapper <PlayerViewModel, Player> vmToEntityMapper) { this.playerRepository = playerRepository; this.entityToVmMapper = entityToVmMapper; this.vmToEntityMapper = vmToEntityMapper; }
public DeskRoleUserFinder(IEntityMapper <DeskRoleUser, DeskRoleUser> mapper) : base(mapper) { }
public FormEventRepository(ISimpleDbProxy simpleDbProxy, IEntityMapper entityMapper) { _simpleDbProxy = simpleDbProxy; _entityMapper = entityMapper; }
protected EntityRepository(IEntityMapper <T> mapper, IDatabase database) { _mapper = mapper; _database = database; }
public FormEventRepository(IMongoDbProxy mongoDbProxy, IEntityMapper entityMapper) : base(mongoDbProxy, entityMapper) { }
/// <summary> /// Return an enumerable which uses lazy loading of each row. /// </summary> /// <typeparam name="TEntity">Type of entity to map</typeparam> /// <param name="cmd">Command to invoke <c>ExecuteReaderAsync()</c> on.</param> /// <param name="ownsConnection"> /// <c>true</c> if the connection should be disposed together with the command/datareader. See /// remarks. /// </param> /// <param name="mapper">Mapper used to convert rows to entities</param> /// <returns>Lazy loaded enumerator</returns> /// <remarks> /// <para> /// The command is executed asynchronously. /// </para> /// <para> /// The returned enumerator will not map each row until it's requested. To be able to do that the /// connection/command/datareader is /// kept open until the enumerator is disposed. Hence it's important that you make sure that the enumerator is /// disposed when you are /// done with it. /// </para> /// <para> /// Requires that a <c><![CDATA[IEntityMapper<TEntity>]]></c> is registered in the /// <see cref="EntityMappingProvider" />. /// </para> /// </remarks> public static async Task <IEnumerable <TEntity> > ToEnumerableAsync <TEntity>(this IDbCommand cmd, bool ownsConnection, IEntityMapper <TEntity> mapper) { if (cmd == null) { throw new ArgumentNullException("cmd"); } if (mapper == null) { throw new ArgumentNullException("mapper"); } var command = GetDbCommandFromInterface(cmd); try { var reader = await command.ExecuteReaderAsync(); var mapping = EntityMappingProvider.GetBaseMapper <TEntity>(); return(new AdoNetEntityEnumerable <TEntity>(cmd, reader, mapping, ownsConnection)); } catch (Exception e) { throw command.CreateDataException(e); } }
protected EventRepository(IMongoDbProxy mongoDbProxy, IEntityMapper entityMapper) { MongoDbProxy = mongoDbProxy; EntityMapper = entityMapper; }
public GameController(GameRepository gameRepository, IEntityMapper <Game, GameViewModel> entityToVmMapper, IEntityMapper <GameViewModel, Game> vmToEntityMapper) { this.gameRepository = gameRepository; this.entityToVmMapper = entityToVmMapper; this.vmToEntityMapper = vmToEntityMapper; }
/// <summary> /// Initializes a new instance of the <see cref="PostgreSqlRepository{TModel,TEntity}"/> class. /// </summary> /// <param name="repositoryProvider"> /// The repository provider. /// </param> /// <param name="entityMapper"> /// The entity mapper. /// </param> public PostgreSqlRepository(IRepositoryProvider repositoryProvider, IEntityMapper entityMapper) : base(repositoryProvider, entityMapper) { }
public SqliteCommandBuilder(IEntityMapper mapper) : base(mapper) { }
public static ICommandBuilder Create(IEntityMapper mapper) { return _commandBuilder(mapper); }
public SqlServerCommandBuilder(IEntityMapper mapper) : base(mapper) { }
public FootballDbContext(DbContextOptions <FootballDbContext> options, IEntityMapper mapper = null) : base(options) { EntityMapper = mapper; }