public override object GetValue(int index) { SqoColumn col = columns[index]; if (col.SourceType == innerType) { if (col.IsFullObject) { return(siaqodb.LoadObjectByOID(col.SourceType, oids[currentIndex].Value)); } else { return(siaqodb.LoadValue(oids[currentIndex].Value, col.SourcePropName, col.SourceType)); } } else { if (col.IsFullObject) { return(siaqodb.LoadObjectByOID(col.SourceType, oids[currentIndex].Key)); } else { return(siaqodb.LoadValue(oids[currentIndex].Key, col.SourcePropName, col.SourceType)); } } }
protected override Expression VisitParameter(ParameterExpression p) { SqoColumn col = new SqoColumn(); col.SourcePropName = p.Name; col.SourceType = p.Type; col.IsFullObject = true; this.columns.Add(col); return(Expression.Convert(Expression.Call(this.row, miGetValue, Expression.Constant(iColumn++)), p.Type)); }
public async Task <object> GetValueAsync(int index) { SqoColumn col = columns[index]; if (col.IsFullObject) { return(await siaqodb.LoadObjectByOIDAsync(col.SourceType, oids[currentIndex])); } else { return(await siaqodb.LoadValueAsync(oids[currentIndex], col.SourcePropName, col.SourceType)); } }
protected override Expression VisitMemberAccess(MemberExpression m) { if (m.Expression != null && m.Expression.NodeType == ExpressionType.Parameter) { #if WinRT if (m.Member.GetMemberType() == MemberTypes.Property) #else if (m.Member.MemberType == System.Reflection.MemberTypes.Property) #endif { if (m.Member.Name == "OID") { SqoColumn col = new SqoColumn(); col.SourcePropName = m.Member.Name; col.SourceType = m.Expression.Type; this.columns.Add(col); return(Expression.Convert(Expression.Call(this.row, miGetValue, Expression.Constant(iColumn++)), m.Type)); } else { System.Reflection.PropertyInfo pi = m.Member as System.Reflection.PropertyInfo; #if SILVERLIGHT || CF || UNITY3D || WinRT || MONODROID string fieldName = SilverlightPropertyResolver.GetPrivateFieldName(pi, pi.DeclaringType); if (fieldName != null) { SqoColumn col = new SqoColumn(); col.SourcePropName = fieldName; col.SourceType = m.Expression.Type; this.columns.Add(col); return(Expression.Convert(Expression.Call(this.row, miGetValue, Expression.Constant(iColumn++)), m.Type)); } else { string fld = MetaHelper.GetBackingFieldByAttribute(m.Member); if (fld != null) { SqoColumn col = new SqoColumn(); col.SourcePropName = fld; col.SourceType = m.Expression.Type; this.columns.Add(col); return(Expression.Convert(Expression.Call(this.row, miGetValue, Expression.Constant(iColumn++)), m.Type)); } else { throw new SiaqodbException("A Property must have UseVariable Attribute set"); } } #else try { System.Reflection.FieldInfo fi = BackingFieldResolver.GetBackingField(pi); if (fi != null) { SqoColumn col = new SqoColumn(); col.SourcePropName = fi.Name; col.SourceType = m.Expression.Type; this.columns.Add(col); return(Expression.Convert(Expression.Call(this.row, miGetValue, Expression.Constant(iColumn++)), m.Type)); } else { throw new SiaqodbException("A Property must have UseVariable Attribute set"); } } catch { string fld = Sqo.Utilities.MetaHelper.GetBackingFieldByAttribute(m.Member); if (fld != null) { SqoColumn col = new SqoColumn(); col.SourcePropName = fld; col.SourceType = m.Expression.Type; this.columns.Add(col); return(Expression.Convert(Expression.Call(this.row, miGetValue, Expression.Constant(iColumn++)), m.Type)); } else { throw new SiaqodbException("A Property must have UseVariable Attribute set"); } } #endif } } #if WinRT else if (m.Member.GetMemberType() == MemberTypes.Field) #else else if (m.Member.MemberType == System.Reflection.MemberTypes.Field) #endif { SqoColumn col = new SqoColumn(); col.SourcePropName = m.Member.Name; col.SourceType = m.Expression.Type; this.columns.Add(col); return(Expression.Convert(Expression.Call(this.row, miGetValue, Expression.Constant(iColumn++)), m.Type)); } else { throw new NotSupportedException("Not supported Member Type!"); } } else { return(base.VisitMemberAccess(m)); } }