Beispiel #1
0
        /// <summary>
        /// 根据主键获取实体
        /// </summary>
        /// <param name="id">实体主键</param>
        /// <returns></returns>
        public override TEntity Get(TPrimaryKey id)
        {
            var sql = StatementFactory.Select <TEntity>(Dialect.MSSQL, new { Id = id });
            //string sql = "select * from " + typeof(TEntity).ToString() + " where id=@id";
            DynamicParameters para = new DynamicParameters();

            para.Add("id", id);
            return(_dbContext.connection.Query <TEntity>(sql, para).FirstOrDefault());
        }
Beispiel #2
0
 private protected override SelectStatementBuilder <Race> DefaultSelectQuery() =>
 StatementFactory.Select <Race>()
 .Join <Race, Location>((nameof(Race.LocationId), nameof(Location.Id)))
Beispiel #3
0
 private protected override SelectStatementBuilder <SkierEvent> DefaultSelectQuery() =>
 StatementFactory.Select <SkierEvent>()
 .Join <SkierEvent, RaceData>((nameof(SkierEvent.RaceDataId), nameof(RaceData.Id)))
Beispiel #4
0
 private protected override SelectStatementBuilder <RaceData> DefaultSelectQuery() =>
 StatementFactory.Select <RaceData>().Join <RaceData, EventType>((nameof(RaceData.EventTypeId), nameof(EventType.Id)));
Beispiel #5
0
 /// <summary>
 /// 获取实体集合
 /// </summary>
 /// <returns></returns>
 public override List <TEntity> GetAllList()
 {
     return(_dbContext.connection.Query <TEntity>(StatementFactory.Select <TEntity>(Dialect.MSSQL)).ToList());
 }
Beispiel #6
0
 private protected virtual SelectStatementBuilder <T> DefaultSelectQuery() => StatementFactory.Select <T>();