Beispiel #1
0
        public IWhere <T> From <T>(Action <IHelperOptions> cfg = null)
        {
            var data = new HelperOptions(_infos.GetInfo(typeof(T)));

            cfg?.Invoke(data);
            return(SqlBuilder <T>(data));
        }
Beispiel #2
0
        public IConfigureForeignKeys <T, TParent> Reference(params Expression <Func <TParent, object> >[] columns)
        {
            var info = _infos.GetInfo(typeof(TParent));

            _data.ParentTable   = info.Table;
            _data.ParentColumns = columns.GetNames().ToArray();
            return(this);
        }
Beispiel #3
0
        public IMapReaderToPoco <T> CreateMapper <T>(string queryId)
        {
            var type = typeof(T);

            if (type.CheckIfAnonymousType())
            {
                return(new AnonymousTypeMapper <T>());
            }

            if (type == typeof(object))
            {
                return(new DynamicMapper() as IMapReaderToPoco <T>);
            }

            if (type.IsValueType() || type == typeof(string) || type == typeof(byte[]))
            {
                return(new ValueTypeMapper <T>(_converters));
            }
            return(new Mapper <T>(_infoFactory.GetInfo(type), this, queryId));
        }
Beispiel #4
0
 IWhere <T> SqlBuilder <T>(HelperOptions options) => new SimpleSqlBuilder <T>(
     options, _provider, _infos.GetInfo(typeof(T))
     , new ExpressionSqlGenerator(_provider.ExpressionsHelper, _infos, _provider));
Beispiel #5
0
 IWhere <T> SqlBuilder <T>(HelperOptions options, IQueryTemplate <T> template = null) => new SimpleSqlBuilder <T>(
     options, _provider, _infos.GetInfo(typeof(T))
     , new ExpressionSqlGenerator(_provider.ExpressionsHelper, _infos, _provider)
     , template);
 private string GetColumnName(MemberInfo column)
 {
     return(_factory.GetInfo(column.DeclaringType).GetColumnName(column.Name, _escape));
 }