public SelectQuery <TPoco> Join(string forginColumnName, [ValueProvider(nameof(JoinMode))] JoinMode joinAs = null) { var path = PropertyPath <TPoco> .Get(ContainerObject.AccessLayer.Config, forginColumnName) .Where(e => !typeof(IDbCollection).IsAssignableFrom(e.DeclaringType)) .Select(e => { var dbClassInfoCache = ContainerObject.AccessLayer.GetClassInfo(e.DeclaringType); if (dbClassInfoCache.Propertys.ContainsKey(e.Name)) { return(new KeyValuePair <DbClassInfoCache, DbPropertyInfoCache>(dbClassInfoCache, dbClassInfoCache.Propertys[e.Name])); } else { throw new InvalidOperationException($"The expected property '{e.Name}' was not found.") { Data = { { "Class", dbClassInfoCache } } }; } }) .ToArray(); return(JoinOn(this, path, joinAs)); }
/// <summary> /// Prepaires an Conditional Query that targets an single Column /// </summary> /// <typeparam name="TA">The type of a.</typeparam> /// <param name="columnName">Name of the column.</param> /// <returns></returns> public OrderByColumn <TPoco> By <TA>( Expression <Func <TPoco, TA> > columnName) { return(CreateByPath(PropertyPath <TPoco> .Get(columnName) .Select(e => { var dbClassInfoCache = _queryBuilder.ContainerObject.AccessLayer.GetClassInfo(e.DeclaringType); if (dbClassInfoCache.Propertys.ContainsKey(e.Name)) { return new KeyValuePair <DbClassInfoCache, DbPropertyInfoCache>(dbClassInfoCache, dbClassInfoCache.Propertys[e.Name]); } else { throw new InvalidOperationException($"The expected property '{e.Name}' was not found.") { Data = { { "Class", dbClassInfoCache } } }; } }) .ToArray())); }
public void Test2() { const int index1 = 5; const int index2 = 7; var path = PropertyPath <Source> .Get(o => o.L1[index1].L2[index2].Id); Assert.Equal("L1[5].L2[7].Id", path); }
/// <summary> /// Prepaires an Conditional Query that targets an single Column /// </summary> /// <typeparam name="TA">The type of a.</typeparam> /// <param name="columnName">Name of the column.</param> /// <returns></returns> public OrderByColumn <TPoco> By <TA>( Expression <Func <TPoco, TA> > columnName) { return(CreateByPath(PropertyPath <TPoco> .Get(columnName) .Select(e => { var dbClassInfoCache = _queryBuilder.ContainerObject.AccessLayer.GetClassInfo(e.DeclaringType); return new KeyValuePair <DbClassInfoCache, DbPropertyInfoCache>(dbClassInfoCache, dbClassInfoCache.Propertys[e.Name]); }) .ToArray())); }
public SelectQuery <TPoco> Join(string forginColumnName, [ValueProvider(nameof(JoinMode))] JoinMode joinAs = null) { var path = PropertyPath <TPoco> .Get(ContainerObject.AccessLayer.Config, forginColumnName) .Where(e => !typeof(IDbCollection).IsAssignableFrom(e.DeclaringType)) .Select(e => { var dbClassInfoCache = ContainerObject.AccessLayer.GetClassInfo(e.DeclaringType); return(new KeyValuePair <DbClassInfoCache, DbPropertyInfoCache>(dbClassInfoCache, dbClassInfoCache.Propertys[e.Name])); }) .ToArray(); return(JoinOn(path, joinAs)); }
public void Test8() { var path = PropertyPath <Source> .Get(o => o.L1[IndexProperty]); Assert.Equal("L1[5]", path); }
public void Test6() { var path = PropertyPath <Source> .Get(o => o.L1); Assert.Equal("L1", path); }
public void Test5() { var path = PropertyPath <Source> .Get(o => o.L1[5].L2); Assert.Equal("L1[5].L2", path); }
public void Test3() { var path = PropertyPath <Source> .Get(o => o.L1[5].L2[7].Id); Assert.Equal("L1[5].L2[7].Id", path); }
public void Test11() { var path = PropertyPath <Source> .Get(o => o.L1.First()); Assert.Null(path); }
public void Test10() { var path = PropertyPath <Source> .Get(o => o); Assert.Null(path); }