diff --git a/Android-Libtester/Android-Libtester.csproj b/Android-Libtester/Android-Libtester.csproj
index df3c38db..cf24296b 100644
--- a/Android-Libtester/Android-Libtester.csproj
+++ b/Android-Libtester/Android-Libtester.csproj
@@ -46,9 +46,6 @@
..\packages\Newtonsoft.Json.6.0.8\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll
-
- ..\packages\Remotion.Linq.2.0.0-alpha-003\lib\portable-net45+win+wpa81+wp80\Remotion.Linq.dll
-
@@ -82,5 +79,9 @@
{6644D98D-026B-48E9-95A3-61C4D98D82E7}
Kinvey-Xamarin
+
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}
+ Core
+
\ No newline at end of file
diff --git a/Android-Libtester/packages.config b/Android-Libtester/packages.config
index 52806e9e..b7b06e3f 100644
--- a/Android-Libtester/packages.config
+++ b/Android-Libtester/packages.config
@@ -2,5 +2,4 @@
-
\ No newline at end of file
diff --git a/Kinvey-Xamarin-Android/Kinvey-Xamarin-Android.nuspec b/Kinvey-Xamarin-Android/Kinvey-Xamarin-Android.nuspec
index a2013743..0651d511 100644
--- a/Kinvey-Xamarin-Android/Kinvey-Xamarin-Android.nuspec
+++ b/Kinvey-Xamarin-Android/Kinvey-Xamarin-Android.nuspec
@@ -1,15 +1,18 @@
-
+
- Kinvey-Android
- 1.2.0
- Kinvey-Xamarin-Android
- Kinvey
- Kinvey
+ $id$
+ $version$
+ $title$
+ $author$
+ $author$
+ http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE
+ http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE
+ http://ICON_URL_HERE_OR_DELETE_THIS_LINE
false
- Build Xamarin Android apps which leverage the power of Kinvey's BaaS, with support for users, data, and files, with caching and offline. Check out http://devcenter.kinvey.com/xamarin for guides, tutorials, and sample apps.
- Initial Release with support for Push Notifications through GCM
+ $description$
+ Summary of changes made in this release of the package.
Copyright 2015
- Kinvey BaaS
+ Tag1 Tag2
\ No newline at end of file
diff --git a/Kinvey-Xamarin-iOS/Kinvey-Xamarin-iOS.nuspec b/Kinvey-Xamarin-iOS/Kinvey-Xamarin-iOS.nuspec
new file mode 100644
index 00000000..0651d511
--- /dev/null
+++ b/Kinvey-Xamarin-iOS/Kinvey-Xamarin-iOS.nuspec
@@ -0,0 +1,18 @@
+
+
+
+ $id$
+ $version$
+ $title$
+ $author$
+ $author$
+ http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE
+ http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE
+ http://ICON_URL_HERE_OR_DELETE_THIS_LINE
+ false
+ $description$
+ Summary of changes made in this release of the package.
+ Copyright 2015
+ Tag1 Tag2
+
+
\ No newline at end of file
diff --git a/Kinvey-Xamarin.sln b/Kinvey-Xamarin.sln
index f1504fd7..6642701b 100644
--- a/Kinvey-Xamarin.sln
+++ b/Kinvey-Xamarin.sln
@@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS-TestDrive", "..\..\ksam
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kinvey-Xamarin-iOS", "Kinvey-Xamarin-iOS\Kinvey-Xamarin-iOS.csproj", "{77548067-6F95-461C-A4D1-A051E20D30C5}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "..\..\thirdparty\csharp\Relinq\Core\Core.csproj", "{028E7899-0D5F-49C8-9EB6-8B051E02F1E0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -34,6 +36,24 @@ Global
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Release|iPhone.Build.0 = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{444456B1-5B55-48D6-9637-00ADCA92B7C9}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{444456B1-5B55-48D6-9637-00ADCA92B7C9}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{444456B1-5B55-48D6-9637-00ADCA92B7C9}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
diff --git a/Kinvey-Xamarin/AppData.cs b/Kinvey-Xamarin/AppData.cs
index bdb7bfd3..13ffc32d 100644
--- a/Kinvey-Xamarin/AppData.cs
+++ b/Kinvey-Xamarin/AppData.cs
@@ -21,8 +21,6 @@
using System.IO;
using System.Linq.Expressions;
using System.Collections;
-using LinqExtender;
-using Ast = LinqExtender.Ast;
using Newtonsoft.Json.Linq;
using Remotion.Linq.Parsing.Structure;
using KinveyUtils;
diff --git a/Kinvey-Xamarin/Auth/KinveyAuthRequest.cs b/Kinvey-Xamarin/Auth/KinveyAuthRequest.cs
index 8b94fcad..301495e1 100644
--- a/Kinvey-Xamarin/Auth/KinveyAuthRequest.cs
+++ b/Kinvey-Xamarin/Auth/KinveyAuthRequest.cs
@@ -304,8 +304,12 @@ public Builder(AbstractKinveyClient transport, string appKey, string appSecret,
public Builder(AbstractKinveyClient transport, string appKey, string appSecret, string username, string password, User user)
: this(transport, appKey, appSecret, user)
{
+ this.client = transport;
+ this.appKeyAuthentication = new HttpBasicAuthenticator(appKey, appSecret);
+ this.appKey = appKey;
this.username = username;
this.password = password;
+ this.user = user;
}
diff --git a/Kinvey-Xamarin/DefaultContext.cs b/Kinvey-Xamarin/DefaultContext.cs
deleted file mode 100644
index 3a21724d..00000000
--- a/Kinvey-Xamarin/DefaultContext.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Collections.Generic;
-using LinqExtender;
-using Ast = LinqExtender.Ast;
-
-namespace KinveyXamarin
-{
- ///
- /// Default context to be queried.
- ///
- /// Target type
- public class DefaultContext : ExpressionVisitor, IQueryContext
- {
- ///
- /// Invoked during execution of the query , with the
- /// pre populated expression tree.
- ///
- /// Target expression block
- /// Expected result
- public IEnumerable Execute(Ast.Expression expression)
- {
- //TODO: Visit the extender expression to build your meta
-
- this.Visit(expression);
-
- ///TOOD: return your result.
- return null;
- }
- }
-}
diff --git a/Kinvey-Xamarin/Kinvey-Xamarin.csproj b/Kinvey-Xamarin/Kinvey-Xamarin.csproj
index c0c4c5fc..dd431c28 100644
--- a/Kinvey-Xamarin/Kinvey-Xamarin.csproj
+++ b/Kinvey-Xamarin/Kinvey-Xamarin.csproj
@@ -68,8 +68,6 @@
-
-
@@ -89,7 +87,6 @@
-
@@ -117,9 +114,6 @@
..\packages\Newtonsoft.Json.6.0.8\lib\portable-net45+wp80+win8+wpa81+aspnetcore50\Newtonsoft.Json.dll
-
- ..\packages\LinqExtender.3.0.1\lib\LinqExtender.dll
-
..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll
@@ -129,11 +123,14 @@
..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll
-
- ..\packages\Remotion.Linq.2.0.0-alpha-003\lib\portable-net45+win+wpa81+wp80\Remotion.Linq.dll
+
+ ..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wp8+wpa81\Microsoft.Threading.Tasks.dll
+
+
+ ..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wp8+wpa81\Microsoft.Threading.Tasks.Extensions.dll
- ..\packages\modernhttpclient.2.4.1\lib\Portable-Net45+WinRT45+WP8+WPA81\ModernHttpClient.dll
+ ..\packages\modernhttpclient.2.4.2\lib\Portable-Net45+WinRT45+WP8+WPA81\ModernHttpClient.dll
@@ -145,5 +142,9 @@
{444456B1-5B55-48D6-9637-00ADCA92B7C9}
Kinvey-Utils
+
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}
+ Core
+
\ No newline at end of file
diff --git a/Kinvey-Xamarin/Kinvey-Xamarin.nuspec b/Kinvey-Xamarin/Kinvey-Xamarin.nuspec
index 9caa8aa1..a029095f 100644
--- a/Kinvey-Xamarin/Kinvey-Xamarin.nuspec
+++ b/Kinvey-Xamarin/Kinvey-Xamarin.nuspec
@@ -1,24 +1,27 @@
-
+
Kinvey
- //TODO
+ 1.5.0
+ * Full support for iOS, with release of Kinvey-Xamarin-ios library * Refactoring LINQ implementation * Updating SQLite dependencies
Kinvey-Xamarin
Kinvey
Kinvey
false
Build Xamarin apps which leverage the power of Kinvey's BaaS, with support for users, data, and files, with caching and offline. Check out http://devcenter.kinvey.com/xamarin for guides, tutorials, and sample apps.
- //TODO
Copyright 2015
http://devcenter.kinvey.com/xamarin/
Kinvey BaaS
-
+
+
-
-
-
+
+
+
+
+
diff --git a/Kinvey-Xamarin/Query/ExpressionVisitor.cs b/Kinvey-Xamarin/Query/ExpressionVisitor.cs
deleted file mode 100644
index 6cc17418..00000000
--- a/Kinvey-Xamarin/Query/ExpressionVisitor.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-Copyright (c) 2007- 2010 LinqExtender Toolkit Project.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-using System;
-using LinqExtender;
-using Ast = LinqExtender.Ast;
-
-
-namespace KinveyXamarin
-{
- ///
- /// This class is used by the LINQ implementation to visit expressions.
- ///
- public class ExpressionVisitor
- {
-
- ///
- /// This method determines the behaivor dependant on the current expression
- ///
- /// Expression.
- internal Ast.Expression Visit(Ast.Expression expression)
- {
- switch (expression.CodeType)
- {
- case CodeType.BlockExpression:
- return VisitBlockExpression((Ast.BlockExpression)expression);
- case CodeType.TypeExpression:
- return VisitTypeExpression((Ast.TypeExpression)expression);
- case CodeType.LambdaExpresion:
- return VisitLambdaExpression((Ast.LambdaExpression)expression);
- case CodeType.LogicalExpression:
- return VisitLogicalExpression((Ast.LogicalExpression)expression);
- case CodeType.BinaryExpression:
- return VisitBinaryExpression((Ast.BinaryExpression)expression);
- case CodeType.LiteralExpression:
- return VisitLiteralExpression((Ast.LiteralExpression)expression);
- case CodeType.MemberExpression:
- return VisitMemberExpression((Ast.MemberExpression)expression);
- case CodeType.OrderbyExpression:
- return VisitOrderbyExpression((Ast.OrderbyExpression)expression);
- }
-
- throw new ArgumentException("Expression type is not supported");
- }
-
- ///
- /// Visits the type expression.
- ///
- /// The type expression.
- /// Type expression.
- public virtual Ast.Expression VisitTypeExpression(Ast.TypeExpression typeExpression)
- {
- return typeExpression;
- }
-
- ///
- /// Visits the block expression.
- ///
- /// The block expression.
- /// Block expression.
- public virtual Ast.Expression VisitBlockExpression(Ast.BlockExpression blockExpression)
- {
- foreach (var expression in blockExpression.Expressions)
- this.Visit(expression);
-
- return blockExpression;
- }
-
- ///
- /// Visits the logical expression.
- ///
- /// The logical expression.
- /// Expression.
- public virtual Ast.Expression VisitLogicalExpression(Ast.LogicalExpression expression)
- {
- this.Visit(expression.Left);
- this.Visit(expression.Right);
- return expression;
- }
-
- ///
- /// Visits the lambda expression.
- ///
- /// The lambda expression.
- /// Expression.
- public virtual Ast.Expression VisitLambdaExpression(Ast.LambdaExpression expression)
- {
- if (expression.Body != null)
- return this.Visit(expression.Body);
- return expression;
- }
-
- ///
- /// Visits the binary expression.
- ///
- /// The binary expression.
- /// Expression.
- public virtual Ast.Expression VisitBinaryExpression(Ast.BinaryExpression expression)
- {
- this.Visit(expression.Left);
- this.Visit(expression.Right);
-
- return expression;
- }
-
- ///
- /// Visits the member expression.
- ///
- /// The member expression.
- /// Expression.
- public virtual Ast.Expression VisitMemberExpression(Ast.MemberExpression expression)
- {
- return expression;
- }
-
- ///
- /// Visits the literal expression.
- ///
- /// The literal expression.
- /// Expression.
- public virtual Ast.Expression VisitLiteralExpression(Ast.LiteralExpression expression)
- {
- return expression;
- }
-
- ///
- /// Visits the orderby expression.
- ///
- /// The orderby expression.
- /// Expression.
- public virtual Ast.Expression VisitOrderbyExpression(Ast.OrderbyExpression expression)
- {
- return expression;
- }
-
- }
-}
diff --git a/Kinvey-Xamarin/Query/KinveyQueryContext.cs b/Kinvey-Xamarin/Query/KinveyQueryContext.cs
deleted file mode 100644
index 1f05945e..00000000
--- a/Kinvey-Xamarin/Query/KinveyQueryContext.cs
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright (c) 2015, Kinvey, Inc. All rights reserved.
-//
-// This software is licensed to you under the Kinvey terms of service located at
-// http://www.kinvey.com/terms-of-use. By downloading, accessing and/or using this
-// software, you hereby accept such terms of service (and any agreement referenced
-// therein) and agree that you have read, understand and agree to be bound by such
-// terms of service and are of legal age to agree to such terms with Kinvey.
-//
-// This software contains valuable confidential and proprietary information of
-// KINVEY, INC and is subject to applicable licensing agreements.
-// Unauthorized reproduction, transmission or distribution of this file and its
-// contents is a violation of applicable laws.
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using Ast = LinqExtender.Ast;
-using LinqExtender;
-
-namespace KinveyXamarin
-{
-
- ///
- /// Kinvey query context, providing support for LINQ queries.
- ///
- public abstract class KinveyQueryContext : ExpressionVisitor, IQueryContext
- {
- ///
- /// The client.
- ///
- protected AbstractClient client;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Client.
- public KinveyQueryContext(AbstractClient client){
- this.client = client;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Client.
- /// Writer.
- public KinveyQueryContext (AbstractClient client, IQueryBuilder writer)
- {
- this.writer = writer;
- this.client = client;
- }
-
- ///
- /// Executes the current Linq query.
- ///
- ///
- ///
- /// Expression.
- public IEnumerable Execute(Ast.Expression expression)
- {
- writer.Write ("{");
- this.Visit(expression);
- writer.Write ("}");
-
- T[] ret = executeQuery (writer.GetFullString());
- writer.Reset ();
-
- return ret;
-
- }
-
- ///
- /// Visits the type expression.
- ///
- /// The type expression.
- /// Type expression.
- /// Expression.
- public override Ast.Expression VisitTypeExpression(Ast.TypeExpression expression)
- {
- //this one is a no-op because we don't support typing, (one type per collection and no joins)
-
- return expression;
- }
-
- ///
- /// Visits the lambda expression.
- ///
- /// The lambda expression.
- /// Expression.
- public override Ast.Expression VisitLambdaExpression(Ast.LambdaExpression expression)
- {
- //another no-op, `where` clause is implicit in Mongo
- this.Visit(expression.Body);
- return expression;
- }
-
- ///
- /// Visits the binary expression.
- ///
- /// The binary expression.
- /// Expression.
- public override Ast.Expression VisitBinaryExpression(Ast.BinaryExpression expression)
- {
- //gte, lte, lt, gt, eq, ne, contains are binary expressions
- this.Visit(expression.Left);
- writer.Write(GetBinaryOperator(expression.Operator));
- this.Visit(expression.Right);
-
- return expression;
- }
-
- ///
- /// Visits the logical expression.
- ///
- /// The logical expression.
- /// Expression.
- public override Ast.Expression VisitLogicalExpression(Ast.LogicalExpression expression)
- {
- //And, Or are logical expressions
-
- if (expression.Operator == LogicalOperator.And) {
-
- this.Visit (expression.Left);
-
- writer.Write (",");
-
- this.Visit (expression.Right);
-
- } else {
- //it's an OR
- writer.Write ("$or:");
- writer.Write("[");
- writer.Write ("{");
- this.Visit (expression.Left);
- writer.Write ("},");
- writer.Write ("{");
- this.Visit (expression.Right);
- writer.Write ("}");
- writer.Write ("]");
- }
-
- return expression;
- }
-
- ///
- /// Visits the member expression.
- ///
- /// The member expression.
- /// Expression.
- public override Ast.Expression VisitMemberExpression(Ast.MemberExpression expression)
- {
-
-
- //expression.FullName returns `MyClass.MyField`, need to remove `MyClass.`
- //so find the first index of the . and then substring from one character after it.
- string withoutClassDec = expression.FullName.Substring (expression.FullName.IndexOf (".") + 1);
-
- writer.Write(String.Format("\"{0}\"", withoutClassDec));
- return expression;
- }
-
- ///
- /// Visits the literal expression.
- ///
- /// The literal expression.
- /// Expression.
- public override Ast.Expression VisitLiteralExpression(Ast.LiteralExpression expression)
- {
- //TODO literal expression is where type is implied by a constant's inline declaration -> string, "hey" or float, 10f
- WriteValue(expression.Type, expression.Value);
- return expression;
- }
-
- ///
- /// Visits the orderby expression.
- ///
- /// The orderby expression.
- /// Expression.
- public override Ast.Expression VisitOrderbyExpression(Ast.OrderbyExpression expression)
- {
-
- //ascending, descending
- string sort = "&sort={\"" + expression.Member.Name + "\":" + (expression.Ascending ? "1" : "-1") + "}";
- writer.Dangle (sort);
-
- return expression;
- }
-
- ///
- /// Gets the binary operator.
- ///
- /// The binary operator.
- /// Operator.
- private static string GetBinaryOperator(BinaryOperator @operator)
- {
- switch (@operator)
- {
- case BinaryOperator.Equal:
- return ":";
- }
- throw new ArgumentException("Invalid binary operator");
- }
-
- ///
- /// Writes the logical operator.
- ///
- /// Logical operator.
- private void WriteLogicalOperator(LogicalOperator logicalOperator)
- {
- WriteSpace();
-
- writer.Write(logicalOperator.ToString().ToUpper());
-
-
- WriteSpace();
- }
-
- ///
- /// Writes a space.
- ///
- private void WriteSpace()
- {
- writer.Write(" ");
- }
-
- ///
- /// Writes a new line.
- ///
- private void WriteNewLine()
- {
- writer.Write(Environment.NewLine);
- }
-
- ///
- /// Writes the token if reqiured by the expression.
- ///
- /// Expression.
- /// Token.
- private void WriteTokenIfReq(Ast.LogicalExpression expression, Token token)
- {
- if (expression.IsChild)
- {
- WriteToken(token);
- }
- }
-
- ///
- /// Writes the token.
- ///
- /// Token.
- private void WriteToken(Token token)
- {
- switch (token)
- {
- case Token.LeftParenthesis:
- writer.Write("(");
- break;
- case Token.RightParentThesis:
- writer.Write(")");
- break;
- }
- }
-
- ///
- /// Available tokens to write
- ///
- public enum Token
- {
- LeftParenthesis,
- RightParentThesis
- }
-
- ///
- /// Writes the value.
- ///
- /// Type.
- /// Value.
- private void WriteValue(TypeReference type, object value)
- {
- if (type.UnderlyingType == typeof(string))
- writer.Write(String.Format("\"{0}\"", value));
- else
- writer.Write(value);
- }
-
- ///
- /// Write the specified value.
- ///
- /// Value.
- private void Write(string value)
- {
- writer.Write(value);
- }
-
- ///
- /// The query builder.
- ///
- public IQueryBuilder writer;
-
- ///
- /// The parameter.
- ///
- public bool parameter;
-
- ///
- /// Executes the query.
- ///
- /// The query.
- /// Query.
- protected abstract T[] executeQuery(string query);
- }
-
-
-}
diff --git a/Kinvey-Xamarin/Query/KinveyQueryExecutor.cs b/Kinvey-Xamarin/Query/KinveyQueryExecutor.cs
index f806ec11..4cb7b018 100644
--- a/Kinvey-Xamarin/Query/KinveyQueryExecutor.cs
+++ b/Kinvey-Xamarin/Query/KinveyQueryExecutor.cs
@@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
using Remotion.Linq.Clauses;
-using Remotion.Linq.Clauses.ExpressionTreeVisitors;
+//using Remotion.Linq.Clauses.ExpressionTreeVisitors;
using System.Linq;
using Remotion.Linq.Parsing.Structure;
using System.Collections.ObjectModel;
diff --git a/Kinvey-Xamarin/lib/Kinvey-Utils.dll b/Kinvey-Xamarin/lib/Kinvey-Utils.dll
new file mode 100755
index 00000000..cd894d03
Binary files /dev/null and b/Kinvey-Xamarin/lib/Kinvey-Utils.dll differ
diff --git a/Kinvey-Xamarin/lib/Kinvey-Xamarin.dll b/Kinvey-Xamarin/lib/Kinvey-Xamarin.dll
new file mode 100755
index 00000000..39fbb660
Binary files /dev/null and b/Kinvey-Xamarin/lib/Kinvey-Xamarin.dll differ
diff --git a/Kinvey-Xamarin/lib/RestSharp.Portable.dll b/Kinvey-Xamarin/lib/RestSharp.Portable.dll
new file mode 100755
index 00000000..08eda47c
Binary files /dev/null and b/Kinvey-Xamarin/lib/RestSharp.Portable.dll differ
diff --git a/Kinvey-Xamarin/packages.config b/Kinvey-Xamarin/packages.config
index cd871f24..bd88fd81 100644
--- a/Kinvey-Xamarin/packages.config
+++ b/Kinvey-Xamarin/packages.config
@@ -1,12 +1,11 @@
-
+
-
+
-
\ No newline at end of file
diff --git a/LibTester/LibTester.csproj b/LibTester/LibTester.csproj
index f1914502..2f065255 100644
--- a/LibTester/LibTester.csproj
+++ b/LibTester/LibTester.csproj
@@ -32,9 +32,6 @@
..\packages\NUnit.2.6.4\lib\nunit.framework.dll
-
- ..\packages\Remotion.Linq.2.0.0-alpha-003\lib\net40\Remotion.Linq.dll
-
@@ -59,5 +56,9 @@
{BA2352E1-CB07-4795-A2EB-F70720B2BBC9}
RestSharp.Portable
+
+ {028E7899-0D5F-49C8-9EB6-8B051E02F1E0}
+ Core
+
\ No newline at end of file
diff --git a/LibTester/packages.config b/LibTester/packages.config
index 65acf8ab..2dd2f820 100644
--- a/LibTester/packages.config
+++ b/LibTester/packages.config
@@ -2,5 +2,4 @@
-
\ No newline at end of file
diff --git a/LinqExtender/Abstraction/IBucket.cs b/LinqExtender/Abstraction/IBucket.cs
deleted file mode 100644
index 9becbb99..00000000
--- a/LinqExtender/Abstraction/IBucket.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System.Collections.Generic;
-
-namespace LinqExtender.Abstraction
-{
- ///
- /// Interfae defining Bucket object and its accesible proeprties.
- ///
- internal interface IBucket
- {
- ///
- /// Gets the name of the object, either the class name or value of OriginalEntityName, if used.
- ///
- string Name { get;}
-
- ///
- /// Gets/Sets true if an where is clause used.
- ///
- bool IsDirty { get; }
-
- ///
- /// Gets/Sets Items to Take from collection.
- ///
- int? ItemsToTake { get;}
-
- ///
- /// Gets/ Sets items to skip from start.
- ///
- int ItemsToSkip { get; }
-
- ///
- /// Gets for property.
- ///
- IDictionary Items { get;}
-
- ///
- /// Gets a list of methods executed on the query.
- ///
- IList Methods { get; }
-
- ///
- /// Gets the order by information set in query.
- ///
- IList OrderByItems { get; }
-
- ///
- /// Returns property name for which the UniqueIdentifierAttribute is defined.
- ///
- string[] UniqueItems { get; }
- }
-}
diff --git a/LinqExtender/Abstraction/IClassGenerator.cs b/LinqExtender/Abstraction/IClassGenerator.cs
deleted file mode 100644
index 6ad1f8db..00000000
--- a/LinqExtender/Abstraction/IClassGenerator.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-
-namespace LinqExtender.Abstraction
-{
- ///
- /// Entry point interface for
- ///
- public interface IClassGenerator
- {
- ///
- /// Builds the dynamic assembly.
- ///
- ///
- IClassGenerator BuildDynamicAssembly();
- ///
- /// Builds a type in the dynamic assembly, if already the type is not created.
- ///
- /// type of object or interfae to implement
- /// parent interface type.
- ///
- IClassGenerator CreateType(Type parentType, Type interfaceType);
- ///
- /// Adds properties to the dynamic type.
- ///
- ///
- ///
- ///
- IClassGenerator AddProperty(string name, object value);
- ///
- /// Creates a new instance of the dynamically generated type.
- ///
- ///
- /// source object from where to copy the properties.
- ///
- T CreateInstance(object source);
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Abstraction/IContainer.cs b/LinqExtender/Abstraction/IContainer.cs
deleted file mode 100644
index 5535762d..00000000
--- a/LinqExtender/Abstraction/IContainer.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Abstraction
-{
- ///
- /// Defaines common propeties for accessing or .
- ///
- public interface IContainer
- {
- ///
- /// Gets the current container.
- ///
- IContainer Container { get;}
- ///
- /// Gets the name of the current container.
- ///
- string Name { get; }
- }
-}
diff --git a/LinqExtender/Abstraction/IMethodCall.cs b/LinqExtender/Abstraction/IMethodCall.cs
deleted file mode 100644
index d7f99749..00000000
--- a/LinqExtender/Abstraction/IMethodCall.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-namespace LinqExtender.Abstraction
-{
- ///
- /// Query item interface for direct calls on collection.
- ///
- ///
- public interface IMethodCall
- {
- ///
- /// Returns a single item from the collection.
- ///
- ///
- T Single();
- ///
- /// Returns a single item or default value if empty.
- ///
- ///
- T SingleOrDefault();
- ///
- /// Returns the first item from the collection.
- ///
- ///
- T First();
- ///
- /// Returns first item or default value if empty.
- ///
- ///
- T FirstOrDefault();
- ///
- /// Returns the last item from the collection.
- ///
- ///
- T Last();
- ///
- /// Returns last item or default value if empty.
- ///
- ///
- T LastOrDefault();
- }
-
- ///
- /// Non generic query call interface.
- ///
- public interface IMethodCall
- {
- ///
- /// Return true if there is any item in collection.
- ///
- ///
- bool Any();
- ///
- /// Returns the count of items in the collection.
- ///
- ///
- object Count();
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Abstraction/IModifiableCollection.cs b/LinqExtender/Abstraction/IModifiableCollection.cs
deleted file mode 100644
index e6765664..00000000
--- a/LinqExtender/Abstraction/IModifiableCollection.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Abstraction
-{
- ///
- /// Generic inteface for modifying collecion.
- ///
- public interface IModifiableCollection
- {
- ///
- /// Clears out items from collection.
- ///
- void Clear();
- ///
- /// Sorts the collection, using the orderby clause used in query.
- ///
- void Sort();
- }
-
- ///
- /// Non generic interface for modifying colleciton items.
- ///
- ///
- public interface IModifiableCollection : IMethodCall, IMethodCall, IModifiableCollection
- {
- ///
- /// Marks an item to be removed.
- ///
- /// query object.
- void Remove(T value);
- ///
- /// Addes a range of items to the collection.
- ///
- ///
- void AddRange(IEnumerable items);
- ///
- /// Adds items to the main collection and does a sort operation if any orderby is used in query.
- ///
- ///
- ///
- void AddRange(IEnumerable items, bool inMemorySort);
- ///
- /// Adds a new item to the collection
- ///
- ///
- void Add(T item);
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Abstraction/IQueryContextImpl.cs b/LinqExtender/Abstraction/IQueryContextImpl.cs
deleted file mode 100644
index 9bef75f4..00000000
--- a/LinqExtender/Abstraction/IQueryContextImpl.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Abstraction
-{
- internal interface IQueryContextImpl : IQueryContext
- {
- IModifiableCollection Collection { get; }
- }
-}
diff --git a/LinqExtender/Abstraction/IQueryObject.cs b/LinqExtender/Abstraction/IQueryObject.cs
deleted file mode 100644
index 52a92e1a..00000000
--- a/LinqExtender/Abstraction/IQueryObject.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Abstraction
-{
- ///
- /// Interface for making an object queryable.
- ///
- public interface IQueryObject
- {
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Abstraction/IQueryObjectImpl.cs b/LinqExtender/Abstraction/IQueryObjectImpl.cs
deleted file mode 100644
index 6b66a2ce..00000000
--- a/LinqExtender/Abstraction/IQueryObjectImpl.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Abstraction
-{
- ///
- /// Internal class for query object.
- ///
- public interface IQueryObjectImpl : IQueryObject
- {
- ///
- /// Get/Sets if an item is delted from the collection.
- ///
- bool IsDeleted { get; set; }
- ///
- /// Gets/Sets if an item is newly added to the collection.
- ///
- bool IsNewlyAdded { get; }
- ///
- /// Gets/Sets if an item is updated.
- ///
- bool IsAltered { get; }
-
- ///
- /// fills up the bucket from current object.
- ///
- ///
- ///
- Bucket FillBucket(Bucket bucket);
- ///
- /// fills the object from working bucket.
- ///
- ///
- void FillObject(Bucket source);
- ///
- /// fills up the property of current object.
- ///
- ///
- ///
- ///
- void FillProperty(string name, object value, Type returnType);
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Abstraction/IVersionItem.cs b/LinqExtender/Abstraction/IVersionItem.cs
deleted file mode 100644
index d9974d91..00000000
--- a/LinqExtender/Abstraction/IVersionItem.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace LinqExtender.Abstraction
-{
- interface IVersionItem
- {
- void Commit();
- void Revert();
- object Item { get; }
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Ast/BinaryExpression.cs b/LinqExtender/Ast/BinaryExpression.cs
deleted file mode 100755
index 783a7793..00000000
--- a/LinqExtender/Ast/BinaryExpression.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-namespace LinqExtender.Ast
-{
- ///
- /// Represents the binary operation.
- ///
- public class BinaryExpression : Expression
- {
- private BinaryOperator @operator;
- private Expression left;
- private Expression right;
-
- ///
- /// Initalizes a new instance of the class.
- ///
- /// Target operator
- internal BinaryExpression(BinaryOperator @operator)
- {
- this.@operator = @operator;
- }
-
- ///
- /// Gets the left expression.
- ///
- public Expression Left
- {
- get
- {
- return left;
- }
- internal set
- {
- left = value;
- }
- }
-
- ///
- /// Gets the right expression
- ///
- public Expression Right
- {
- get
- {
- return right;
- }
- internal set
- {
- right = value;
- }
- }
-
- ///
- /// Gets the binary operator.
- ///
- public BinaryOperator Operator
- {
- get
- {
- return @operator;
- }
- }
-
- ///
- /// Gets a value indicating the type of expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.BinaryExpression; }
- }
- }
-}
diff --git a/LinqExtender/Ast/BlockExpression.cs b/LinqExtender/Ast/BlockExpression.cs
deleted file mode 100755
index 9ad920dd..00000000
--- a/LinqExtender/Ast/BlockExpression.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Combines a number expressions sequentially
- ///
- public class BlockExpression : Ast.Expression
- {
- internal BlockExpression()
- {
- expressions = new List();
- }
-
- ///
- /// Gets the list of expression associated with the current query.
- ///
- public IList Expressions
- {
- get
- {
- return expressions;
- }
- }
-
- ///
- /// Gets a value indicating the type of expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.BlockExpression; }
- }
-
- private IList expressions;
- }
-}
diff --git a/LinqExtender/Ast/Expression.cs b/LinqExtender/Ast/Expression.cs
deleted file mode 100755
index c9777379..00000000
--- a/LinqExtender/Ast/Expression.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Abstract expression base that represents the LINQ query.
- ///
- public abstract class Expression
- {
- ///
- /// Gets a value indicating the type of expression.
- ///
- public abstract CodeType CodeType { get; }
- }
-}
diff --git a/LinqExtender/Ast/LambdaExpression.cs b/LinqExtender/Ast/LambdaExpression.cs
deleted file mode 100755
index 3944cc16..00000000
--- a/LinqExtender/Ast/LambdaExpression.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Defines lambda expression.
- ///
- public class LambdaExpression : Expression
- {
- ///
- /// Initailizes a new instance of the class.
- ///
- /// Target object type.
- public LambdaExpression(Type type)
- {
- this.type = type;
- }
-
- ///
- /// Gets the underlying type of the expression.
- ///
- public Type Type
- {
- get
- {
- return type;
- }
- }
-
- ///
- /// Gets the body of the expression.
- ///
- public Expression Body
- {
- get
- {
- return body;
- }
- internal set
- {
- body = value;
- }
- }
-
- ///
- /// Gets the type of the expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.LambdaExpresion; }
- }
-
- Type type;
- Expression body;
-
- }
-}
diff --git a/LinqExtender/Ast/LiteralExpression.cs b/LinqExtender/Ast/LiteralExpression.cs
deleted file mode 100755
index 304540b0..00000000
--- a/LinqExtender/Ast/LiteralExpression.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Represents the extracted value of a query item.
- ///
- public class LiteralExpression : Expression
- {
-
- internal LiteralExpression(Type type, object value)
- {
- this.type = new TypeReference(type);
- this.value = value;
- }
-
- ///
- /// Gets the target type.
- ///
- public TypeReference Type
- {
- get
- {
- return type;
- }
- }
-
- ///
- /// Gets the value that is evaulated from linq query.
- ///
- public object Value
- {
- get
- {
- return value;
- }
- }
-
- ///
- /// Gets the type of the expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.LiteralExpression; }
- }
-
- private object value;
- private TypeReference type;
- }
-}
diff --git a/LinqExtender/Ast/LogicalExpression.cs b/LinqExtender/Ast/LogicalExpression.cs
deleted file mode 100755
index 90b55900..00000000
--- a/LinqExtender/Ast/LogicalExpression.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-
-namespace LinqExtender.Ast
-{
- ///
- /// Reprensents Logical blocks.
- ///
- public class LogicalExpression : Expression
- {
- ///
- /// Intializes a new instance of the class.
- ///
- /// Logical operator
- internal LogicalExpression(LogicalOperator @operator)
- {
- this.@operator = @operator;
- }
-
- ///
- /// Gets the left expression.
- ///
- public Expression Left
- {
- get
- {
- return left;
- }
- internal set
- {
- left = value;
- }
- }
-
- ///
- /// Gets the right exprssison.
- ///
- public Expression Right
- {
- get
- {
- return right;
- }
- internal set
- {
- right = value;
- }
- }
-
- ///
- /// Gets value that indicates that the current is a child expression.
- ///
- public bool IsChild
- {
- get
- {
- return isChild;
- }
- internal set
- {
- isChild = value;
- }
- }
-
- ///
- /// Gets the operator joining the left and right expression.
- ///
- public LogicalOperator Operator
- {
- get
- {
- return @operator;
- }
- }
-
- ///
- /// Gets the type of the expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.LogicalExpression; }
- }
-
- private readonly LogicalOperator @operator;
- private bool isChild;
- private Expression left;
- private Expression right;
- }
-}
diff --git a/LinqExtender/Ast/MemberExpression.cs b/LinqExtender/Ast/MemberExpression.cs
deleted file mode 100755
index f44a227f..00000000
--- a/LinqExtender/Ast/MemberExpression.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-using System.Reflection;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Represents query members
- ///
- public class MemberExpression : Expression
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// Target
- internal MemberExpression(BucketItem item)
- {
- this.item = item;
- this.member = new MemberReference(item.MemberInfo);
- }
-
- ///
- /// Gets the member reference.
- ///
- public MemberReference Member
- {
- get
- {
- return member;
- }
- }
-
- ///
- /// Gets the name of the member.
- ///
- public string Name
- {
- get
- {
- return member.Name;
- }
- }
-
- ///
- /// Gets the full name of the member.
- ///
- public string FullName
- {
- get
- {
- return this.item.FullName;
- }
- }
-
- ///
- /// Gets the declaring type for the member.
- ///
- public Type DeclaringType
- {
- get
- {
- return this.item.DeclaringType;
- }
- }
-
- ///
- /// Finds the target custom attribute for the member.
- ///
- public T FindAttribute()
- {
- return (T)item.FindAttribute(typeof(T));
- }
-
- ///
- /// Gets the type of the expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.MemberExpression; }
- }
-
- private BucketItem item;
- private MemberReference member;
- }
-}
diff --git a/LinqExtender/Ast/MethodCallExpression.cs b/LinqExtender/Ast/MethodCallExpression.cs
deleted file mode 100644
index 889a4462..00000000
--- a/LinqExtender/Ast/MethodCallExpression.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-
-using System.Reflection;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Defines method calls on the query
- ///
- public class MethodCallExpression : Expression
- {
- internal MethodCallExpression(MethodCall methodCall)
- {
- this.methodCall = methodCall;
- }
-
- ///
- /// Gets the target
- ///
- public object Target
- {
- get
- {
- return methodCall.Target;
- }
- }
-
- ///
- /// Gets the underlying method info.
- ///
- public MethodInfo Method
- {
- get
- {
- return methodCall.Method;
- }
- }
-
- ///
- /// Gets a value indicating that it is a take call.
- ///
- public bool IsTake
- {
- get
- {
- return methodCall.Method.Name == MethodNames.Take;
- }
- }
-
- ///
- /// Gets a value indicating that it is a skip method.
- ///
- public bool IsSkip
- {
- get
- {
- return methodCall.Method.Name == MethodNames.Skip;
- }
- }
-
- ///
- /// Gets the method parameters.
- ///
- public MethodCall.Parameter [] Paramters
- {
- get
- {
- return methodCall.Parameters;
- }
- }
-
- public override CodeType CodeType
- {
- get { return CodeType.MethodCallExpression; }
- }
-
- private readonly MethodCall methodCall;
- }
-}
diff --git a/LinqExtender/Ast/OrderbyExpression.cs b/LinqExtender/Ast/OrderbyExpression.cs
deleted file mode 100755
index 1ed0e66a..00000000
--- a/LinqExtender/Ast/OrderbyExpression.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Represents order by query.
- ///
- public class OrderbyExpression : Ast.Expression
- {
- ///
- /// Intializes a new instance of the class.
- ///
- /// Target memberReference
- /// Sort order
- internal OrderbyExpression(MemberReference memberReference, bool ascending)
- {
- this.memberReference = memberReference;
- this.ascending = ascending;
- }
-
- ///
- /// Gets the associated member.
- ///
- public MemberReference Member
- {
- get
- {
- return memberReference;
- }
- }
-
- ///
- /// Gets a value indicating if the order should be made in ascending order.
- ///
- public bool Ascending
- {
- get
- {
- return ascending;
- }
- }
-
- ///
- /// Gets the type of the expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.OrderbyExpression; }
- }
-
- private MemberReference memberReference;
- private bool ascending;
- }
-}
diff --git a/LinqExtender/Ast/TypeExpression.cs b/LinqExtender/Ast/TypeExpression.cs
deleted file mode 100755
index f43ff6bc..00000000
--- a/LinqExtender/Ast/TypeExpression.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Ast
-{
- ///
- /// Represents the target type.
- ///
- public class TypeExpression : Expression
- {
- ///
- /// Initalizes a new instance of the class.
- ///
- /// Target type
- internal TypeExpression(Type type)
- {
- this.type = type;
- }
-
- ///
- /// Gets the underlying type.
- ///
- public TypeReference Type
- {
- get
- {
- return new TypeReference(this.type);
- }
- }
-
- ///
- /// Gets the type of the expression.
- ///
- public override CodeType CodeType
- {
- get { return CodeType.TypeExpression; }
- }
-
- private Type type;
-
- }
-}
diff --git a/LinqExtender/Attributes/IgnoreAttribute.cs b/LinqExtender/Attributes/IgnoreAttribute.cs
deleted file mode 100644
index f8e30ecc..00000000
--- a/LinqExtender/Attributes/IgnoreAttribute.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-
-namespace LinqExtender.Attributes
-{
- ///
- /// Under this attribute present, property will be ignored by extender.
- ///
- [AttributeUsage(AttributeTargets.Property)]
- public class IgnoreAttribute : System.Attribute
- {
-
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Attributes/NameAttribute.cs b/LinqExtender/Attributes/NameAttribute.cs
deleted file mode 100644
index 175940a5..00000000
--- a/LinqExtender/Attributes/NameAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-
-namespace LinqExtender.Attributes
-{
- ///
- /// Marks a class property or class with special name
- ///
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
- public sealed class NameAttribute : Attribute
- {
- ///
- /// Initalizes a new instance of the class.
- ///
- /// Name of the reflected object.
- public NameAttribute(string targetName)
- {
- this.targetName = targetName;
- }
-
- ///
- /// maps to the name of the original enity name.
- ///
- public string Name
- {
- get
- {
- return targetName;
- }
- }
-
- private readonly string targetName = string.Empty;
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Attributes/UniqueIdentifierAttribute.cs b/LinqExtender/Attributes/UniqueIdentifierAttribute.cs
deleted file mode 100644
index 23fba4a9..00000000
--- a/LinqExtender/Attributes/UniqueIdentifierAttribute.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Attributes
-{
- ///
- /// Defines a property to be unique.
- ///
- [AttributeUsage(AttributeTargets.Property)]
- public class UniqueIdentifierAttribute : System.Attribute
- {
-
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/BinaryOperator.cs b/LinqExtender/BinaryOperator.cs
deleted file mode 100644
index 81bb1399..00000000
--- a/LinqExtender/BinaryOperator.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-namespace LinqExtender
-{
- ///
- /// Represents the relational query operator equavalent.
- ///
- public enum BinaryOperator
- {
- ///
- /// Eqavalent of "=="
- ///
- Equal = 0,
- ///
- /// Eqavalent of ">"
- ///
- GreaterThan,
- ///
- /// Eqavalent of
- ///
- LessThan,
- ///
- /// Eqavalent of ">="
- ///
- GreaterThanEqual,
- ///
- /// Eqavalent of
- ///
- LessThanEqual,
- ///
- /// Eqavalent of "!="
- ///
- NotEqual,
- ///
- /// Defines the Contains operation in expression.
- ///
- Contains,
- ///
- /// Default value for first where clause item
- ///
- NotApplicable
-
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Bucket.cs b/LinqExtender/Bucket.cs
deleted file mode 100644
index 4ca78a1f..00000000
--- a/LinqExtender/Bucket.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using LinqExtender.Abstraction;
-using System;
-using System.Reflection;
-using System.Linq.Expressions;
-
-namespace LinqExtender
-{
- ///
- /// Bucket is stuctured representation of the orignal query object.
- ///
- public class Bucket : IBucket, IContainer
- {
- ///
- /// Gets/ sets the name of the container.
- ///
- public IContainer Container { get; internal set; }
-
- ///
- /// Gets the name of the object, either the class name or value of OriginalEntityName, if used.
- ///
- public string Name
- {
- get
- {
- return name;
- }
- internal set
- {
- name = value;
- }
- }
-
- ///
- /// Gets/Sets true if an where is clause used.
- ///
- public bool IsDirty { get; internal set; }
- ///
- /// Gets/Sets Items to Take from collection.
- ///
- public int? ItemsToTake { get; internal set; }
- ///
- /// Gets/ Sets items to skip from start.
- ///
- public int ItemsToSkip { get; internal set; }
-
- ///
- /// Returns property name for which the UniqueIdentifierAttribute is defined.
- ///
- public string[] UniqueItems
- {
- get
- {
- if (uniqueItemNames == null)
- {
- var query = from prop in items
- where prop.Value.Unique
- select prop.Value.Name;
-
- uniqueItemNames = query.ToArray();
- }
- return uniqueItemNames;
- }
- }
- ///
- /// Contains property items for current bucket.
- ///
- public IDictionary Items
- {
- get
- {
- if (items == null)
- items = new Dictionary();
- return items;
- }
- internal set
- {
- items = value;
- }
- }
-
- ///
- /// Gets the first tree node fro simplied expression tree.
- ///
- internal TreeNode CurrentNode
- {
- get
- {
- if (node == null)
- node = new TreeNode();
- return node;
- }
- set
- {
- node = value;
- }
- }
- ///
- /// Gets/Sets the current
- ///
- internal TreeNode CurrentTreeNode
- {
- get; set;
- }
-
- ///
- /// Gets a list of methods executed on the query.
- ///
- public IList Methods
- {
- get
- {
- if (methods == null)
- methods = new List();
-
- return methods;
- }
- }
-
- ///
- /// The Filled up with query order by information.
- ///
- public class OrderByInfo
- {
- ///
- /// Gets the member associated with the current orderby call.
- ///
- public MemberReference Member
- {
- get
- {
- return memberReference;
- }
- }
- ///
- /// Gets true if the order by is ascending.
- ///
- public bool IsAscending
- {
- get
- {
- return asc;
- }
- }
-
- internal OrderByInfo(MemberReference memberReference, bool asc)
- {
- this.memberReference = memberReference;
- this.asc = asc;
- }
-
- private readonly bool asc;
- private readonly MemberReference memberReference;
- }
-
- ///
- /// Contains the group by detail.
- ///
- public class GroupByContainer
- {
- ///
- /// Gets or set the key by which group by will be made.
- ///
- public string Key { get; set; }
- }
-
- ///
- /// Holds order by information.
- ///
- public IList OrderByItems
- {
- get
- {
- if (orderByItems == null)
- orderByItems = new List();
- return orderByItems;
- }
- }
-
- ///
- /// Gets or set the group container.
- ///
- public GroupByContainer Group { get; set; }
-
-
- ///
- /// Gets unique identifier properties.
- ///
- internal string[] UniqueProperties
- {
- get
- {
- if (uniquePropertyNames == null)
- {
- var query = from prop in items
- where prop.Value.Unique
- select prop.Value.ProperyName;
-
- uniquePropertyNames = query.ToArray();
- }
- return uniquePropertyNames;
- }
- }
-
- ///
- /// Clears out any used properties.
- ///
- protected void Clear()
- {
- ItemsToSkip = 0;
- ItemsToTake = null;
- OrderByItems.Clear();
- IsDirty = false;
- }
-
- private string name = string.Empty;
- private IList methods;
- private string[] uniqueItemNames;
- private string[] uniquePropertyNames;
- private IDictionary items;
- private IList orderByItems;
- private TreeNode node;
-
-
- }
-}
diff --git a/LinqExtender/BucketImpl.cs b/LinqExtender/BucketImpl.cs
deleted file mode 100644
index a86a6bfa..00000000
--- a/LinqExtender/BucketImpl.cs
+++ /dev/null
@@ -1,224 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.Reflection;
-using LinqExtender.Attributes;
-
-namespace LinqExtender
-{
- internal class BucketImpl : Bucket
- {
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- public BucketImpl(Type targetType)
- {
- this.targetType = targetType;
- }
-
- static internal BucketImpl NewInstance(Type targetType)
- {
- return new BucketImpl(targetType);
- }
-
- ///
- /// marks if the bucket is already prepared or not.
- ///
- internal bool Processed { get; set; }
-
- ///
- /// internal use : to check if the bucket object should be sorted in asc or dsc
- ///
- internal bool IsAsc { get; set; }
-
- ///
- /// Defines the current expression node.
- ///
- internal ExpressionType CurrentExpessionType { get; set; }
-
- ///
- /// number of items queried in Where caluse
- ///
- internal int ClauseItemCount { get; set; }
-
- ///
- /// gets the Level of the clause item
- ///
- internal int Level { get; set; }
-
-
- internal BucketImpl Init()
- {
- object[] attr = targetType.GetCustomAttributes(typeof(NameAttribute), true);
- if (attr.Length > 0)
- {
- var originalEntityNameAtt = attr[0] as NameAttribute;
- if (originalEntityNameAtt != null) this.Name = originalEntityNameAtt.Name;
- }
- else
- {
- Name = targetType.Name;
- }
- // clear out;
- Clear();
-
- // create new items
- Items = CreateItems(targetType);
-
- return this;
- }
-
-
- public Stack SyntaxStack
- {
- get
- {
- if (syntaxStack == null)
- syntaxStack = new Stack();
-
- return syntaxStack;
- }
- }
-
- internal class TreeNodeInfo
- {
- public int Level
- {
- get;
- set;
- }
- public LogicalOperator CompoundOperator { get; set; }
- ///
- /// identifier
- ///
- public Guid Id { get; set; }
- public Guid ParentId { get; set; }
- }
-
- internal BinaryOperator Relation
- {
- get
- {
- BinaryOperator relType = BinaryOperator.Equal;
-
- switch (CurrentExpessionType)
- {
- case ExpressionType.Equal:
- relType = BinaryOperator.Equal;
- break;
- case ExpressionType.GreaterThan:
- relType = BinaryOperator.GreaterThan;
- break;
- case ExpressionType.LessThan:
- relType = BinaryOperator.LessThan;
- break;
- case ExpressionType.NotEqual:
- relType = BinaryOperator.NotEqual;
- break;
- case ExpressionType.LessThanOrEqual:
- relType = BinaryOperator.LessThanEqual;
- break;
- case ExpressionType.GreaterThanOrEqual:
- relType = BinaryOperator.GreaterThanEqual;
- break;
- }
- return relType;
- }
-
- }
-
- ///
- /// clear outs the data.
- ///
- protected new void Clear()
- {
- base.Clear();
-
- ClauseItemCount = 0;
- CurrentExpessionType = ExpressionType.Equal;
- Processed = false;
- }
-
-
- public BucketImpl InstanceImpl
- {
- get
- {
- return this;
- }
- }
-
- private IDictionary CreateItems(Type target)
- {
- PropertyInfo[] infos = target.GetProperties();
-
- IDictionary list = new Dictionary();
-
- foreach (PropertyInfo info in infos)
- {
- if (info.CanRead && info.CanWrite)
- {
-
- string fieldName = string.Empty;
-
- object[] arg = info.GetCustomAttributes(typeof (IgnoreAttribute), false);
-
- if (arg.Length == 0)
- {
- const bool visible = true;
-
- arg = info.GetCustomAttributes(typeof (NameAttribute), false);
-
- if (arg.Length > 0)
- {
- var fieldNameAttr = arg[0] as NameAttribute;
-
- if (fieldNameAttr != null)
- fieldName = fieldNameAttr.Name;
- }
- else
- {
- fieldName = info.Name;
- }
-
- arg = info.GetCustomAttributes(typeof (UniqueIdentifierAttribute), true);
-
- bool isUnique = arg.Length > 0;
-
- // only if not already added.
- if (!list.ContainsKey(info.Name))
- {
- var newItem = new BucketItem(target, fieldName, info.Name, info.PropertyType, null, isUnique,
- BinaryOperator.Equal, visible) {Container = this};
- list.Add(info.Name, newItem);
- }
- }
- }
- }
- return list;
- }
-
- private Stack syntaxStack;
- private Type targetType;
- }
- ///
- /// internal implementation of bucket object
- ///
- internal class BucketImpl : BucketImpl
- {
- public BucketImpl(): base(typeof(T)) {}
-
- #region Fluent BucketImpl
-
- static new internal BucketImpl NewInstance
- {
- get
- {
- return new BucketImpl();
- }
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/BucketItem.cs b/LinqExtender/BucketItem.cs
deleted file mode 100644
index 384546f6..00000000
--- a/LinqExtender/BucketItem.cs
+++ /dev/null
@@ -1,487 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.Reflection;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender
-{
- ///
- /// Contains the detail for quried or valued items.
- ///
- public class BucketItem : IContainer
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public BucketItem()
- {
- // intentionally left blank.
- }
-
- ///
- /// Gets or sets the container.
- ///
- public IContainer Container { get; set; }
-
- ///
- /// Get or sets the child.
- ///
- public Bucket Child { get; set; }
-
- ///
- /// Represents the conditioal operators and its compared values for where clause.
- ///
- public class QueryCondition
- {
- ///
- /// Creates a new instance of the
- ///
- /// value
- /// type of operation
- public QueryCondition(object value, BinaryOperator type)
- {
- Value = value;
- QueryOperator = type;
- }
-
- ///
- /// Gets the query item value.
- ///
- public object Value
- {
- get
- {
- return value;
- }
- set
- {
- // not a first time visit and , value altered.
- if (this.value != null && this.value.Equals(value))
- {
- changed = false;
- }
- else
- {
- changed = true;
- this.value = value;
- }
- }
- }
- ///
- /// Represents the comparison operators like !=, >=, etc
- ///
- public BinaryOperator QueryOperator { get; set; }
-
- internal bool Changed
- {
- get
- {
- return changed;
- }
- }
-
- private object value = null;
- private bool changed = false;
- }
-
-
- ///
- /// Creates a new bucket object.
- ///
- /// Type of the bucket object
- /// Name of the item that maps with source
- /// Name of property regardless of OriginalFieldNameAttribute
- /// Type of the underlying property.
- /// Value of the item
- /// if unique attriube is defined for item
- /// Eelation type , defines what type of expression, equal, lessthan or other.
- /// Marks that it is to be used in query expression
- internal BucketItem(Type underlyingType, string name, string propertyName, Type propertyType, object value, bool unique, BinaryOperator queryOperator, bool queryVisible)
- {
- this.declaringType = underlyingType;
- // new condtions
- Values.Clear();
-
- // if value is provided.
- if (value != null)
- {
- Values.Add(new QueryCondition(value, queryOperator));
- }
-
- // set values.
- this.unique = unique;
- Name = name;
- ProperyName = propertyName;
- Visible = queryVisible;
- this.propertyType = propertyType;
- }
-
- private IList _conditions;
- ///
- /// Return multiple values if item quried with different values in same where clause.
- ///
- public IList Values
- {
- get
- {
- if (_conditions == null)
- _conditions = new List();
- return _conditions;
- }
- }
-
- ///
- /// Return values for quried item in where clause.
- /// Optionally, tries to combine the value for nested class queries.
- /// Optionally, creates object[] for system and abstract types.
- /// Return values in raw format regardless of its releation type.
- ///
- public object Value
- {
- get
- {
- if (Values.Count > 1)
- {
- Type targetType = Values[0].Value.GetType();
-
- if (targetType.IsAbstract
- || targetType.IsEnum
- || targetType.IsPrimitive
- || targetType.FullName.IndexOf("System") >= 0)
- {
-
- Array array = Array.CreateInstance(targetType, Values.Count);
-
- int index = 0;
-
- foreach (QueryCondition value in Values)
- {
- array.SetValue(value.Value, index);
- index++;
- }
- return array;
- }
-
- if (targetType.IsClass)
- {
- return Values.Combine(targetType);
- }
- }
-
- if (Values.Count > 0)
- return Values[0].Value;
- return null;
- }
- set
- {
- if (Values.Count == 1)
- {
- Values[0].Value = value;
- Values[0].QueryOperator = BinaryOperator.Equal;
- }
- else if (Values.Count == 0)
- {
- Values.Add(new QueryCondition(value, BinaryOperator.Equal));
- }
- }
- }
-
- ///
- /// Determines if the item is used multiple times in where clause.
- ///
- public bool HasMultipleValues
- {
- get
- {
- return Values.Count > 1;
- }
- }
-
- ///
- /// Return RelationType enum for the quried item.
- ///
- public BinaryOperator Operator
- {
- get
- {
- if (Values.Count > 0)
- return Values[0].QueryOperator;
- return LinqExtender.BinaryOperator.NotApplicable;
- }
- }
-
- ///
- /// Name of the property or value of OriginalFieldNameAttribute if used.
- ///
- public string Name
- {
- get
- {
- // if its a method call.
- if (this.Method != null)
- name = Convert.ToString(this.Method.DynamicInvoke());
- return name;
- }
- set
- {
- name = value;
- }
- }
-
- ///
- /// Gets the fully qualified name of the .
- ///
- public string FullName
- {
- get
- {
- if (this.Method != null)
- {
- return (string) this.Method.DynamicInvoke();
- }
- return GetFullContainerName(this.Container) + "." + this.Name;
- }
- }
- ///
- /// Name of property that bucketItem represents.
- ///
- public string ProperyName { get; internal set; }
- ///
- /// Gets or sets the method used in query.
- ///
- public ExtenderMethod Method { get; internal set; }
-
- ///
- /// Gets or sets the member info.
- ///
- public MemberInfo MemberInfo { get; internal set; }
-
- ///
- /// Type of the property that bucketItem represents.
- ///
- public Type PropertyType
- {
- get
- {
- return this.propertyType;
- }
- set
- {
- this.propertyType = value;
- }
- }
- ///
- /// Gets if a property is unique.
- ///
- public bool Unique
- {
- get
- {
- return unique;
- }
- set
- {
- unique = value;
- }
- }
-
- ///
- /// true if user updatas the property value manually.
- ///
- public bool IsModified
- {
- get; internal set;
- }
-
- ///
- /// Determines if the item is not maked to be Ignored by IgnoreAttribute
- ///
- internal bool Visible { get; set; }
-
- ///
- /// Gets or sets a value indicating if an item is already visited.
- ///
- internal bool IsVisited { get; set; }
-
- ///
- /// Gets the underlying object type.
- ///
- public Type DeclaringType
- {
- get
- {
- return declaringType;
- }
- internal set
- {
- declaringType = value;
- }
- }
-
- ///
- /// Sets the value to target object.
- ///
- ///
- ///
- ///
- public void SetValue(object target, object value)
- {
- var info = target.GetType().GetProperty(ProperyName, this.propertyType);
- if (info != null) info.SetValue(target, value, null);
- }
-
- ///
- /// Gets the value for a target object.
- ///
- ///
- public object GetValue(object target)
- {
- var info = target.GetType().GetProperty(ProperyName, this.propertyType);
- return info.GetValue(target, null);
- }
-
- ///
- /// finds the attribute, within property
- ///
- ///
- ///
- public object FindAttribute(Type type)
- {
- var info = declaringType.GetProperty(ProperyName, this.propertyType);
-
- if (info != null)
- {
- object[] args = info.GetCustomAttributes(type, true);
-
- if (args.Length == 0)
- {
- return null;
- }
- return args[0];
- }
-
- return null;
- }
-
- ///
- /// Validates and finds the active item with value.
- ///
- ///
- public BucketItem GetActiveItem()
- {
- // no child return what is there.
- if (this.Child == null)
- return this;
- return ProcessNestedBucket(this.Child);
- }
-
- private BucketItem ProcessNestedBucket(Bucket bucket)
- {
- foreach (string key in bucket.Items.Keys)
- {
- BucketItem childItem = bucket.Items[key];
-
- if (childItem.Value != null && !childItem.IsVisited)
- {
- childItem.IsVisited = true;
- return childItem;
- }
-
- if (childItem.Child != null)
- {
- return ProcessNestedBucket(childItem.Child);
- }
- }
-
- return null;
- }
-
- internal IDictionary Children
- {
- get
- {
- if (children == null)
- children = new Dictionary();
- return children;
- }
- }
-
- private string GetFullContainerName(IContainer container)
- {
- string containerName= string.Empty;
-
- if (container.Container != null)
- {
- containerName = GetFullContainerName(container.Container);
- if (container is Bucket)
- {
- // move on.
- }
- else
- {
- containerName = String.Format("{0}.{1}", containerName.TrimEnd(new[] { '.' }), container.Name);
- }
- }
- else
- {
- if (container is BucketItem || container.Container == null)
- containerName = container.Name;
- }
-
- return containerName;
- }
-
- ///
- /// Cotains the detail of the method used in query.
- ///
- public class ExtenderMethod
- {
- ///
- /// Gets Name of the method.
- ///
- public string Name { get; internal set; }
- ///
- /// Gets / Sets the arguments
- ///
- internal MethodInfo Method{ get; set;}
- internal IList Arguments { get; set; }
-
- ///
- /// Gets the return type.
- ///
- public object ReturnType
- {
- get
- {
- return Method.ReturnType;
- }
- }
- ///
- /// Dynamically invokes the method.
- ///
- ///
- public object DynamicInvoke()
- {
- var args = new object[Arguments.Count];
-
- int index = 0;
- foreach (Expression @argument in Arguments)
- {
- args[index++] = Expression.Lambda(@argument).Compile().DynamicInvoke();
- }
-
- object target = Activator.CreateInstance(Method.DeclaringType);
-
- return Method.Invoke(target, args);
- }
- }
-
-
- private bool unique;
- private Type declaringType;
- private Type propertyType;
- private IDictionary children;
- private string name;
- }
-}
diff --git a/LinqExtender/Buckets.cs b/LinqExtender/Buckets.cs
deleted file mode 100644
index 4e7e0395..00000000
--- a/LinqExtender/Buckets.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace LinqExtender
-{
- internal class Buckets : Dictionary
- {
- public BucketImpl Current
- {
- get
- {
- Ensure(typeof(T));
- return current;
- }
- set
- {
- this[typeof (T)] = value;
- }
- }
-
- private void Ensure(Type targetType)
- {
- if (this.ContainsKey(targetType))
- {
- // set the current object.
- current = this[targetType].InstanceImpl;
- }
- }
-
- private BucketImpl current = null;
-
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/ClassGenerator.cs b/LinqExtender/ClassGenerator.cs
deleted file mode 100644
index 3386aa17..00000000
--- a/LinqExtender/ClassGenerator.cs
+++ /dev/null
@@ -1,214 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Reflection.Emit;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender
-{
- ///
- /// Generates a new object from existing one using the user's setup.
- ///
- internal class ClassGenerator : IClassGenerator
- {
- ///
- /// Creates and gets a new instance class.
- ///
- public static ClassGenerator Instance
- {
- get
- {
- return new ClassGenerator();
- }
- }
- ///
- /// Builds dynamic assembly.
- ///
- ///
- public IClassGenerator BuildDynamicAssembly()
- {
- AssemblyName assemblyName = new AssemblyName("ExtenderProxy");
- AssemblyBuilder createdAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
- // define module
- this.moduleBuilder = createdAssembly.DefineDynamicModule(assemblyName.Name);
-
- this.isTypeCreated = false;
-
- return this;
- }
-
- ///
- /// Builds a type in the dynamic assembly, if already the type is not created.
- ///
- /// type of object or interfae to implement
- /// parent interface type.
- ///
- public IClassGenerator CreateType(Type parent, Type interfaceType)
- {
- // create the list.
- properties = new Dictionary();
-
- // define a type only if it is not previously defined.
- if (parent != null && this.moduleBuilder.GetType(parent.FullName) == null)
- {
- if (parent.IsInterface)
- {
- this.typeBuilder = this.moduleBuilder.DefineType(parent.FullName, TypeAttributes.Class | TypeAttributes.Public);
- this.typeBuilder.AddInterfaceImplementation(parent);
- }
- else
- {
- this.typeBuilder = this.moduleBuilder.DefineType(parent.FullName, TypeAttributes.Class | TypeAttributes.Public, parent);
- }
-
- if (interfaceType != null)
- {
- this.typeBuilder.AddInterfaceImplementation(interfaceType);
- }
-
- ConstructorBuilder constructorBuilder = this.typeBuilder.DefineConstructor(MethodAttributes.Public,
- CallingConventions.Standard,
- Type.EmptyTypes);
-
- ILGenerator ilGenerator = constructorBuilder.GetILGenerator();
-
- ConstructorInfo baseConstructor = null;
- ConstructorInfo[] constructorInfos = parent.GetConstructors();
-
- bool containsDefaultConstructor = false;
-
- foreach (ConstructorInfo info in constructorInfos)
- {
- if (info.GetParameters().Length == 0)
- {
- baseConstructor = info;
- containsDefaultConstructor = true;
- break;
- }
- }
-
- if (!containsDefaultConstructor)
- throw new Exception(Messages.MustHaveADefaultConstructor);
-
- ilGenerator.Emit(OpCodes.Ldarg_0);
- ilGenerator.Emit(OpCodes.Call, baseConstructor);
- ilGenerator.Emit(OpCodes.Ret);
- }
-
- return this;
- }
-
- ///
- /// Adds a property dynamically to the type, with specific type.
- ///
- /// name of the property
- /// value of the property
- ///
- public IClassGenerator AddProperty(string name, object value)
- {
- if (this.typeBuilder != null && !this.isTypeCreated)
- {
- Type propertyType = GetTypeFromValue(value);
-
- PropertyBuilder builder = typeBuilder.DefineProperty(name, PropertyAttributes.HasDefault, propertyType, null);
-
- FieldBuilder backingField = typeBuilder.DefineField(name.ToLower(), value.GetType(),
- FieldAttributes.Private);
-
- // The property "set" and property "get" methods require a special
- // set of attributes.
- const MethodAttributes methodAttributes = MethodAttributes.Public | MethodAttributes.NewSlot|
- MethodAttributes.SpecialName | MethodAttributes.HideBySig | MethodAttributes.Virtual;
-
- // Define the "get" accessor.
- MethodBuilder getAccessor = typeBuilder.DefineMethod(
- "get_" + name,
- methodAttributes,
- propertyType,
- Type.EmptyTypes);
-
- ILGenerator getILGenerator = getAccessor.GetILGenerator();
-
- getILGenerator.Emit(OpCodes.Ldarg_0);
- getILGenerator.Emit(OpCodes.Ldfld, backingField);
- getILGenerator.Emit(OpCodes.Ret);
-
- // Define the "set" accessor.
- MethodBuilder setAccessor = typeBuilder.DefineMethod(
- "set_" + name,
- methodAttributes,
- null,
- new Type[] { propertyType });
-
- ILGenerator setILGenerator = setAccessor.GetILGenerator();
-
- setILGenerator.Emit(OpCodes.Ldarg_0);
- setILGenerator.Emit(OpCodes.Ldarg_1);
- setILGenerator.Emit(OpCodes.Stfld, backingField);
- setILGenerator.Emit(OpCodes.Ret);
-
- // Last, map the "get" and "set" accessor methods to the
- // PropertyBuilder. The property is now complete.
- builder.SetGetMethod(getAccessor);
- builder.SetSetMethod(setAccessor);
- }
- properties.Add(name, value);
-
- return this;
- }
- ///
- /// Creates a new instance of the dynamically generated type.
- ///
- ///
- /// source object from where to copy the properties.
- ///
- public T CreateInstance(object source)
- {
- Type reflectedType;
-
- if (isTypeCreated && this.moduleBuilder.GetType(typeof(T).FullName) != null)
- {
- reflectedType = this.moduleBuilder.GetType(typeof(T).FullName);
- }
- else
- {
- reflectedType = this.typeBuilder.CreateType();
- isTypeCreated = true;
- }
-
- object obj = Activator.CreateInstance(reflectedType);
-
- foreach (string key in properties.Keys)
- {
- PropertyInfo pi = reflectedType.GetProperty(key);
- pi.SetValue(obj, properties[key], null);
- }
-
- // fill from existing object.
- foreach (var property in obj.GetType().GetBaseProperties())
- {
- if (property.CanWrite)
- {
- property.SetValue(obj, property.GetValue(source, null), null);
- }
- }
-
- return (T)obj;
- }
-
- ///
- /// Gets a from provided value
- ///
- ///
- ///
- private static Type GetTypeFromValue(object value)
- {
- return value.GetType();
- }
-
- //private TypeBuilder typeBuilder;
- //private ModuleBuilder moduleBuilder;
- private IDictionary properties;
- private bool isTypeCreated;
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/CodeType.cs b/LinqExtender/CodeType.cs
deleted file mode 100644
index b1f64f42..00000000
--- a/LinqExtender/CodeType.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-
-namespace LinqExtender
-{
- ///
- /// Defines Different types of code entries
- ///
- public enum CodeType
- {
- ///
- /// Binary expression.
- ///
- BinaryExpression,
-
- ///
- /// Logical expression
- ///
- LogicalExpression,
-
- ///
- /// Simple expression
- ///
- TypeExpression,
-
- ///
- /// Member expression
- ///
- MemberExpression,
-
- ///
- /// Literal expression
- ///
- LiteralExpression,
-
- ///
- /// Lambda expression
- ///
- LambdaExpresion,
-
- ///
- /// Block expression
- ///
- BlockExpression,
-
- ///
- /// Orderby expression.
- ///
- OrderbyExpression,
-
- ///
- /// MethodCall Expression
- ///
- MethodCallExpression
- }
-}
diff --git a/LinqExtender/Collection/QueryCollection.cs b/LinqExtender/Collection/QueryCollection.cs
deleted file mode 100644
index 0c07b8de..00000000
--- a/LinqExtender/Collection/QueryCollection.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender.Collection
-{
- ///
- /// Contains query objects.
- ///
- public class QueryCollection : IModifiableCollection
- {
- ///
- /// Creates a new instance of class and initialized teh classgenerator.
- ///
- public QueryCollection()
- {
- this.generator = new ClassGenerator().BuildDynamicAssembly();
- }
-
- #region IItemList- Members
-
- ///
- /// Gets/Sets a query object implementation for an index.
- ///
- ///
- ///
- public QueryObject this[int index]
- {
- get
- {
- return list[index];
- }
- set
- {
- list[index] = value;
- }
- }
- ///
- /// returnts true if the sequece contains any element.
- ///
- ///
- public bool Any()
- {
- return list.Count > 0;
- }
- ///
- /// returns only element of the sequece , throws exception if there is no element in
- /// the sequece
- ///
- ///
- public T Single()
- {
- try
- {
- if (list.Count == 0)
- {
- throw new ProviderException(Messages.EmptyCollection);
- }
-
- return list.Single().ReferringObject;
- }
- catch
- {
- throw new ProviderException(Messages.MultipleElementInColleciton);
- }
- }
-
- ///
- /// Returns a single item or default value if empty.
- ///
- ///
- public T SingleOrDefault()
- {
- if (list.Count == 1)
- return list.Single().ReferringObject;
- if (list.Count > 1)
- throw new ProviderException(Messages.MultipleElementInColleciton);
- return default(T);
- }
- ///
- /// returns the count of the sequence
- ///
- ///
- public object Count()
- {
- return list.Count;
- }
- ///
- /// returns the first item of the sequence
- ///
- ///
- public T First()
- {
- return list.First().ReferringObject;
- }
-
- ///
- /// Returns first item or default value if empty.
- ///
- ///
- public T FirstOrDefault()
- {
- if (list.Count > 0)
- return list.First().ReferringObject;
- return default(T);
- }
- ///
- /// returns the last item of the sequence.
- ///
- ///
- public T Last()
- {
- return list.Last().ReferringObject;
- }
- ///
- /// Returns the last item or a default value.
- ///
- ///
- public T LastOrDefault()
- {
- if (list.Count > 0)
- return list.Last().ReferringObject;
- return default(T);
- }
- ///
- /// Marks a item to be removed from the colleciton.
- ///
- ///
- public void Remove(T value)
- {
- foreach (QueryObject item in list)
- {
- if (Utility.IsEqual(item.ReferringObject, value))
- {
- //item.
- (item as IQueryObjectImpl).IsDeleted = true;
- }
- }
- }
- ///
- /// Clears out the collection.
- ///
- public void Clear()
- {
- list.Clear();
- }
- ///
- /// Adds a new item to the collection.
- ///
- ///
- public void Add(T item)
- {
- var queryObject = new QueryObject(item) { ReferringObject = ProcessItem(item) };
-
- if (!queryObject.IsNewlyAdded)
- {
- (queryObject as IVersionItem).Commit();
- }
- list.Add(queryObject);
- }
- ///
- /// Adds a range of items to the collection.
- ///
- ///
- public void AddRange(IEnumerable items)
- {
- foreach (T item in items)
- {
- // add the ref object.
- Add(item);
- }
- }
- ///
- /// Adds items to the main collection and does a sort operation if any orderby is used in query.
- ///
- ///
- ///
- public virtual void AddRange(IEnumerable items, bool inMemorySort)
- {
- //impletmented by child class.
- }
-
- ///
- /// Sorts the collection, using the orderby clause used in query.
- ///
- public virtual void Sort()
- {
-
- }
-
- #endregion
- ///
- /// Gets a list of query item.
- ///
- public List Items
- {
- get
- {
- return list.Select(item => item.ReferringObject).ToList();
- }
- }
- ///
- /// Gets a list of query object implementation.
- ///
- internal List> Objects
- {
- get
- {
- return list;
- }
- }
- ///
- /// Sorts the collection with the provided comparer.
- ///
- ///
- public void Sort(IComparer> comparer)
- {
- list.Sort(comparer);
- }
-
- private T ProcessItem(T item)
- {
- // only if the interface is not implemented.
- if (!(item is IQueryObject))
- {
- // build a proxy with current type.
- return generator.CreateType(typeof (T), typeof (IQueryObject)).CreateInstance(item);
- }
-
- return item;
- }
-
-
- private readonly IClassGenerator generator;
- private readonly List> list = new List>();
-
- }
-}
diff --git a/LinqExtender/Collection/ReadOnlyQueryCollection.cs b/LinqExtender/Collection/ReadOnlyQueryCollection.cs
deleted file mode 100644
index 29014f0f..00000000
--- a/LinqExtender/Collection/ReadOnlyQueryCollection.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender.Collection
-{
- ///
- /// Contains projected read-only query objects.
- ///
- public abstract class ReadOnlyQueryCollection : ExpressionVisitor, IMethodCall, IMethodCall
- {
- ///
- /// collection items
- ///
- protected List Items = new List();
-
- #region IQueryReadOnly Members
-
- ///
- /// Returns a single item from the collection.
- ///
- ///
- T IMethodCall.Single()
- {
- return Items.Single();
- }
-
- ///
- /// Returns a single item or default value if empty.
- ///
- ///
- public T SingleOrDefault()
- {
- if (Items.Count == 1)
- return Items.Single();
- if (Items.Count > 1)
- throw new ProviderException(Messages.MultipleElementInColleciton);
- return default(T);
- }
-
- ///
- /// Return true if there is any item in collection.
- ///
- ///
- public bool Any()
- {
- return Items.Count > 0;
- }
-
- ///
- /// Returns the count of items in the collection.
- ///
- ///
- public object Count()
- {
- return Items.Count;
- }
-
- ///
- /// Returns the first item from the collection.
- ///
- ///
- T IMethodCall.First()
- {
- return Items.First();
- }
-
- ///
- /// Returns first item or default value if empty.
- ///
- ///
- public T FirstOrDefault()
- {
- if (Items.Count > 0)
- return Items.First();
- return default(T);
- }
-
- ///
- /// Returns the last item from the collection.
- ///
- ///
- T IMethodCall.Last()
- {
- return Items.Last();
- }
-
- ///
- /// Returns last item or default value if empty.
- ///
- ///
- public T LastOrDefault()
- {
- if (Items.Count > 0)
- return Items.Last();
- return default(T);
- }
-
- #endregion
- }
-}
diff --git a/LinqExtender/ExpressionVisitor.cs b/LinqExtender/ExpressionVisitor.cs
deleted file mode 100644
index 98c5ddc9..00000000
--- a/LinqExtender/ExpressionVisitor.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Text;
-using System.Threading;
-
-namespace LinqExtender
-{
- ///
- /// Expression visitor
- ///
- public class ExpressionVisitor
- {
- ///
- /// Visits expression and delegates call to different to branch.
- ///
- ///
- ///
- public virtual Expression Visit(Expression expression)
- {
- if (expression == null)
- return null;
-
- switch (expression.NodeType)
- {
- case ExpressionType.Lambda:
- return VisitLamda((LambdaExpression) expression);
- case ExpressionType.ArrayLength:
- case ExpressionType.Convert:
- case ExpressionType.ConvertChecked:
- case ExpressionType.Negate:
- case ExpressionType.UnaryPlus:
- case ExpressionType.NegateChecked:
- case ExpressionType.Not:
- case ExpressionType.Quote:
- case ExpressionType.TypeAs:
- return this.VisitUnary((UnaryExpression)expression);
- case ExpressionType.Add:
- case ExpressionType.AddChecked:
- case ExpressionType.And:
- case ExpressionType.AndAlso:
- case ExpressionType.ArrayIndex:
- case ExpressionType.Coalesce:
- case ExpressionType.Divide:
- case ExpressionType.Equal:
- case ExpressionType.ExclusiveOr:
- case ExpressionType.GreaterThan:
- case ExpressionType.GreaterThanOrEqual:
- case ExpressionType.LeftShift:
- case ExpressionType.LessThan:
- case ExpressionType.LessThanOrEqual:
- case ExpressionType.Modulo:
- case ExpressionType.Multiply:
- case ExpressionType.MultiplyChecked:
- case ExpressionType.NotEqual:
- case ExpressionType.Or:
- case ExpressionType.OrElse:
- case ExpressionType.Power:
- case ExpressionType.RightShift:
- case ExpressionType.Subtract:
- case ExpressionType.SubtractChecked:
- return this.VisitBinary((BinaryExpression)expression);
- case ExpressionType.Call:
- return this.VisitMethodCall((MethodCallExpression)expression);
- case ExpressionType.Constant:
- return this.VisitConstant((ConstantExpression)expression);
- case ExpressionType.MemberAccess:
- return this.VisitMemberAccess((MemberExpression)expression);
- case ExpressionType.Parameter:
- return this.VisitParameter((ParameterExpression)expression);
- case ExpressionType.New:
- return this.VisitNew((NewExpression)expression);
-
- }
- throw new ArgumentOutOfRangeException("expression", expression.NodeType.ToString());
- }
-
- ///
- /// Visits the constance expression. To be implemented by user.
- ///
- ///
- ///
- public virtual Expression VisitConstant(ConstantExpression expression)
- {
- return expression;
- }
-
- ///
- /// Visits the memeber access expression. To be implemented by user.
- ///
- ///
- ///
- public virtual Expression VisitMemberAccess(MemberExpression expression)
- {
- return expression;
- }
-
- ///
- /// Visits the method call expression.
- ///
- ///
- ///
- public virtual Expression VisitMethodCall(MethodCallExpression expression)
- {
- return expression;
- }
-
- ///
- /// Visits the binary expression.
- ///
- ///
- ///
- public virtual Expression VisitBinary(BinaryExpression expression)
- {
- this.Visit(expression.Left);
- this.Visit(expression.Right);
- return expression;
- }
-
- ///
- /// Visits the unary expression.
- ///
- ///
- ///
- public virtual Expression VisitUnary(UnaryExpression expression)
- {
- this.Visit(expression.Operand);
- return expression;
- }
-
- ///
- /// Visits the lambda expression.
- ///
- ///
- ///
- public virtual Expression VisitLamda(LambdaExpression lambdaExpression)
- {
- this.Visit(lambdaExpression.Body);
- return lambdaExpression;
- }
-
- ///
- /// Visits the parameter
- ///
- private Expression VisitParameter(ParameterExpression expression)
- {
- return expression;
- }
-
- ///
- /// Visits the new type expression.
- ///
- public virtual Expression VisitNew(NewExpression expression)
- {
- return expression;
- }
- }
-}
diff --git a/LinqExtender/Fluent/FluentBucket.cs b/LinqExtender/Fluent/FluentBucket.cs
deleted file mode 100644
index 3e89b137..00000000
--- a/LinqExtender/Fluent/FluentBucket.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using LinqExtender.Abstraction;
-using System;
-
-namespace LinqExtender.Fluent
-{
- ///
- /// Fluent implementation for the bucket object.
- ///
- internal class FluentBucket
- {
- ///
- /// Create a new instance of for a
- ///
- ///
- public FluentBucket(IBucket bucket)
- {
- this.bucket = bucket;
- }
-
- ///
- /// Creates a fluent wrapper of the original bucket object.
- ///
- ///
- ///
- public static FluentBucket As(IBucket bucket)
- {
- return new FluentBucket(bucket);
- }
-
- ///
- /// Creates and gets a new fluent entity object.
- ///
- public FluentEntity Entity
- {
- get
- {
- if (entity == null)
- {
- entity = new FluentEntity(bucket);
- }
- return entity;
- }
- }
-
-
- public FluentMethod Method
- {
- get
- {
- if (method == null)
- {
- method = new FluentMethod(bucket);
- }
-
- return method;
- }
- }
-
-
- ///
- /// Gets true if any where clause is used.
- ///
- public bool IsDirty
- {
- get
- {
- return bucket.IsDirty;
- }
- }
-
-
- ///
- /// Gets the node representing and their relational info.
- ///
- public FluentExpressionTree ExpressionTree
- {
- get
- {
- return new FluentExpressionTree((bucket as Bucket).CurrentNode);
- }
- }
-
- ///
- /// enables BucketItem
- ///
- public FluentIterator For
- {
- get
- {
- return new FluentIterator(bucket);
- }
- }
-
- private IBucket bucket;
- private FluentEntity entity;
- private FluentMethod method;
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Fluent/FluentEntity.cs b/LinqExtender/Fluent/FluentEntity.cs
deleted file mode 100644
index 4919e786..00000000
--- a/LinqExtender/Fluent/FluentEntity.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-using System;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender.Fluent
-{
- ///
- /// Contains Entity Info.
- ///
- public class FluentEntity
- {
- ///
- /// Creates a new instance of
- ///
- ///
- internal FluentEntity(IBucket bucket)
- {
- this.bucket = bucket;
- }
- ///
- /// Name of the entity, can be overriden by OriginalEntityNameAttribute
- ///
- public string Name
- {
- get
- {
- return bucket.Name;
- }
- }
- ///
- /// Gets items to fetch from source.
- ///
- public int? ItemsToFetch
- {
- get
- {
- return bucket.ItemsToTake;
- }
- }
- ///
- /// Default 0, number of items to skip from start.
- ///
- public int ItemsToSkipFromStart
- {
- get
- {
- return bucket.ItemsToSkip;
- }
- }
- ///
- /// List of unique column name.
- ///
- public string UniqueAttribte
- {
- get
- {
- return bucket.UniqueItems[0];
- }
- }
- ///
- /// Defines a fluent implentation for order by query.
- ///
- public class FluentOrderBy
- {
- ///
- /// Creates a new instance of
- ///
- ///
- internal FluentOrderBy(IBucket bucket)
- {
- this.bucket = bucket;
- }
-
- ///
- /// Checks if orderby is used in query and calls action delegate to
- /// execute user's code and internally marks true for ifUsed field
- /// to be used by iterator.
- ///
- ///
- ///
- public FluentOrderBy IfUsed(Action action)
- {
- ifUsed = bucket.OrderByItems.Count > 0;
-
- if (ifUsed && action != null)
- action.DynamicInvoke();
- return this;
- }
- ///
- /// Iterator for order by items.
- ///
- public FluentOrderByItem ForEach
- {
- get
- {
- return new FluentOrderByItem(bucket);
- }
- }
-
- private bool ifUsed = false;
- ///
- /// Callback handler for
- ///
- /// Target member
- /// bool for sort order
- public delegate void Callback(MemberReference member, bool ascending);
- private readonly IBucket bucket;
-
- ///
- /// Order by iterator.
- ///
- public class FluentOrderByItem
- {
- ///
- /// Creates a new instance of
- ///
- ///
- internal FluentOrderByItem(IBucket bucket)
- {
- this.bucket = bucket;
- }
-
- ///
- /// Does a callback to process the order by used in where clause.
- ///
- ///
- public void Process(Callback callback)
- {
- foreach (Bucket.OrderByInfo info in bucket.OrderByItems)
- {
- callback.Invoke(info.Member, info.IsAscending);
- }
- }
-
- private readonly IBucket bucket;
- }
- }
-
- ///
- /// Gets an intance for the
- ///
- public FluentOrderBy OrderBy
- {
- get
- {
- return new FluentOrderBy(bucket);
- }
- }
-
- private readonly IBucket bucket;
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Fluent/FluentExpressionTree.cs b/LinqExtender/Fluent/FluentExpressionTree.cs
deleted file mode 100644
index a6208aa6..00000000
--- a/LinqExtender/Fluent/FluentExpressionTree.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-using System.Diagnostics;
-
-namespace LinqExtender.Fluent
-{
- ///
- /// Fluent implementation for the simplified expression tree.
- ///
- internal class FluentExpressionTree
- {
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- public FluentExpressionTree(TreeNode node)
- {
- this.node = node;
- }
- ///
- /// Gets the tree node.
- ///
- public TreeNode Node
- {
- get
- {
- return node;
- }
- }
- ///
- /// Describes the container for which the expression tree will be evaluated.
- ///
- /// Type of the reference.
- /// Target container
- ///
- public FluentExpressionTree DescribeContainerAs(T container)
- {
- return new FluentExpressionTree(this.Node, container);
- }
-
- private readonly TreeNode node;
- }
- ///
- /// Fluent expression tree.
- ///
- ///
- internal class FluentExpressionTree : FluentExpressionTree
- {
- ///
- /// Initalizes a new instance of the class.
- ///
- ///
- public FluentExpressionTree(TreeNode node)
- : base(node)
- {
- }
- ///
- /// Initalizes a new instance of the class.
- ///
- ///
- ///
- public FluentExpressionTree(TreeNode node, T reference)
- : base(node)
- {
- this.reference = reference;
- }
-
- ///
- /// Invoked for starting
- ///
- ///
- ///
- public FluentExpressionTree Begin(BeginHandler beginHandler)
- {
- begin = beginHandler;
- return this;
- }
-
- ///
- /// Invoked for closing the
- ///
- ///
- ///
- public FluentExpressionTree End(EndHandler endHandler)
- {
- end = endHandler;
- return this;
- }
- ///
- /// Invoked for root
- ///
- ///
- ///
- public FluentExpressionTree Root(RootHandler rootHandler)
- {
- root = rootHandler;
- return this;
- }
- ///
- /// Invoked foreach Leaf
- ///
- ///
- ///
- public FluentExpressionTree EachLeaf(ItemHandler itemHandler)
- {
- this.itemHandler = itemHandler;
- return this;
- }
- ///
- /// Begin handler.
- ///
- ///
- public delegate void BeginHandler(T sender);
- ///
- /// Closing handler.
- ///
- ///
- public delegate void EndHandler(T sender);
- ///
- /// Root handler
- ///
- ///
- ///
- public delegate void RootHandler(T sender, LogicalOperator compoundOperator);
- ///
- /// Leaf node handler.
- ///
- ///
- ///
- public delegate void ItemHandler(T sender, BucketItem item);
-
- private BeginHandler begin;
- private EndHandler end;
- private RootHandler root;
- private ItemHandler itemHandler;
-
-
- [DebuggerStepThrough]
- private void BuildNode(TreeNode tNode)
- {
- if (begin != null)
- begin(reference);
-
- if (tNode.Left != null)
- {
- BuildItem(tNode.Left);
- }
-
- if (tNode.Root != LogicalOperator.None)
- {
- if (root != null)
- root(reference, tNode.Root);
- }
-
- if (tNode.Right != null)
- {
- BuildItem(tNode.Right);
- }
-
- if (end != null)
- end(reference);
- }
-
- private void BuildItem(TreeNode.Node leaf)
- {
- if (leaf.Value is TreeNode)
- {
- BuildNode((TreeNode)leaf.Value);
- }
- else if (leaf.Value is BucketItem)
- {
- BucketItem item = (BucketItem)leaf.Value;
-
- if (itemHandler != null)
- {
- itemHandler(reference, item);
- }
- }
- }
- ///
- /// Builds the logical tree for the expression.
- ///
- public void Execute()
- {
- if (Node == null)
- throw new ProviderException(Messages.MustDefineAContainer);
-
- BuildNode(Node);
- }
-
- private readonly T reference;
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Fluent/FluentIterator.cs b/LinqExtender/Fluent/FluentIterator.cs
deleted file mode 100644
index 0f81b2d3..00000000
--- a/LinqExtender/Fluent/FluentIterator.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using System;
-using System.Linq.Expressions;
-using System.Reflection;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender.Fluent
-{
- ///
- /// Fluent iterator entry point.
- ///
- public class FluentIterator : ExpressionVisitor
- {
- ///
- /// Create a new instance of for
- ///
- ///
- internal FluentIterator(IBucket bucket)
- {
- this.bucket = bucket;
- }
- ///
- /// Fluent Item collection implementation.
- ///
- public class ItemCollection
- {
- ///
- /// Create a new instance of fluent bucket item.
- ///
- ///
- internal ItemCollection(IBucket bucket)
- {
- this.bucket = bucket;
- }
- ///
- /// Matches an for a predicate.
- ///
- ///
- ///
- public ItemCollection Match(Predicate m)
- {
- this.match = m;
- return this;
- }
- ///
- /// Raises a callback.
- ///
- ///
- public ItemCollection Process(Callback callback)
- {
- if (callback == null)
- {
- throw new ProviderException(Messages.MustProvideACallback);
- }
-
- foreach (string key in bucket.Items.Keys)
- {
- BucketItem item = bucket.Items[key];
-
- if (match != null)
- {
- if (match.Invoke(item))
- {
- callback.Invoke(item);
- }
- }
- else
- {
- callback.Invoke(item);
- }
- }
- // tear down
- match = null;
-
- return this;
- }
-
- private readonly IBucket bucket;
- private Predicate match;
- ///
- /// Callback delegate from
- ///
- ///
- public delegate void Callback(BucketItem item);
-
- }
- ///
- /// Gets fluent collection.
- ///
- public ItemCollection EachItem
- {
- get
- {
- if (collecton == null)
- {
- collecton = new ItemCollection(bucket);
- }
- return collecton;
- }
- }
-
- ///
- /// Gets a for name
- ///
- ///
- ///
- public BucketItem Item(string itemName)
- {
- if (bucket.Items.ContainsKey(itemName))
- {
- return bucket.Items[itemName];
- }
- return new BucketItem();
- }
-
- ///
- /// Gets for a property.
- ///
- ///
- ///
- ///
- public BucketItem Item(Expression> expression)
- {
- if (this.memberInfo != null)
- {
- return Item(memberInfo.Name);
- }
- return null;
- }
-
- public override Expression VisitMemberAccess(MemberExpression expression)
- {
- this.memberInfo = expression.Member;
- return expression;
- }
-
- private MemberInfo memberInfo;
- private ItemCollection collecton;
- private readonly IBucket bucket;
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/Fluent/FluentMethod.cs b/LinqExtender/Fluent/FluentMethod.cs
deleted file mode 100644
index d1427bad..00000000
--- a/LinqExtender/Fluent/FluentMethod.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using LinqExtender.Abstraction;
-using System.Linq;
-
-namespace LinqExtender.Fluent
-{
- internal class FluentMethod
- {
- ///
- /// Initializes the instance of class.
- ///
- /// Target bucket
- public FluentMethod(IBucket bucket)
- {
- this.bucket = bucket;
- }
-
- internal void ForEach(Action action)
- {
- for (int index = 0; index < bucket.Methods.Count; index++)
- {
- action(bucket.Methods[index]);
- }
- }
-
- private readonly IBucket bucket;
- }
-}
diff --git a/LinqExtender/IQueryContext.cs b/LinqExtender/IQueryContext.cs
deleted file mode 100644
index 19119880..00000000
--- a/LinqExtender/IQueryContext.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections.Generic;
-
-namespace LinqExtender
-{
- ///
- /// Entry point interface for defining a custom provider.
- ///
- ///
- public interface IQueryContext
- {
- ///
- /// Executes the current Linq query.
- ///
- ///
- ///
- IEnumerable Execute(Ast.Expression exprssion);
- }
-}
diff --git a/LinqExtender/LinqExtender.PackLib/Content/DefaultContext.cs.pp b/LinqExtender/LinqExtender.PackLib/Content/DefaultContext.cs.pp
deleted file mode 100755
index 407e0e72..00000000
--- a/LinqExtender/LinqExtender.PackLib/Content/DefaultContext.cs.pp
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Collections.Generic;
-using LinqExtender;
-using Ast = LinqExtender.Ast;
-
-namespace $rootnamespace$
-{
- ///
- /// Default context to be queried.
- ///
- /// Target type
- public class DefaultContext : ExpressionVisitor, IQueryContext
- {
- ///
- /// Invoked during execution of the query , with the
- /// pre populated expression tree.
- ///
- /// Target expression block
- /// Expected result
- public IEnumerable Execute(Ast.Expression expression)
- {
- //TODO: Visit the extender expression to build your meta
-
- this.Visit(expression);
-
- ///TOOD: return your result.
- return null;
- }
- }
-}
diff --git a/LinqExtender/LinqExtender.PackLib/Content/ExpressionVisitor.cs.pp b/LinqExtender/LinqExtender.PackLib/Content/ExpressionVisitor.cs.pp
deleted file mode 100755
index 9974c080..00000000
--- a/LinqExtender/LinqExtender.PackLib/Content/ExpressionVisitor.cs.pp
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using LinqExtender;
-using Ast = LinqExtender.Ast;
-
-
-namespace $rootnamespace$
-{
- public class ExpressionVisitor
- {
- internal Ast.Expression Visit(Ast.Expression expression)
- {
- switch (expression.CodeType)
- {
- case CodeType.BlockExpression:
- return VisitBlockExpression((Ast.BlockExpression)expression);
- case CodeType.TypeExpression:
- return VisitTypeExpression((Ast.TypeExpression)expression);
- case CodeType.LambdaExpresion:
- return VisitLambdaExpression((Ast.LambdaExpression)expression);
- case CodeType.LogicalExpression:
- return VisitLogicalExpression((Ast.LogicalExpression)expression);
- case CodeType.BinaryExpression:
- return VisitBinaryExpression((Ast.BinaryExpression)expression);
- case CodeType.LiteralExpression:
- return VisitLiteralExpression((Ast.LiteralExpression)expression);
- case CodeType.MemberExpression:
- return VisitMemberExpression((Ast.MemberExpression)expression);
- case CodeType.OrderbyExpression:
- return VisitOrderbyExpression((Ast.OrderbyExpression)expression);
- }
-
- throw new ArgumentException("Expression type is not supported");
- }
-
- public virtual Ast.Expression VisitTypeExpression(Ast.TypeExpression typeExpression)
- {
- return typeExpression;
- }
-
- public virtual Ast.Expression VisitBlockExpression(Ast.BlockExpression blockExpression)
- {
- foreach (var expression in blockExpression.Expressions)
- this.Visit(expression);
-
- return blockExpression;
- }
-
- public virtual Ast.Expression VisitLogicalExpression(Ast.LogicalExpression expression)
- {
- this.Visit(expression.Left);
- this.Visit(expression.Right);
- return expression;
- }
-
- public virtual Ast.Expression VisitLambdaExpression(Ast.LambdaExpression expression)
- {
- if (expression.Body != null)
- return this.Visit(expression.Body);
- return expression;
- }
-
- public virtual Ast.Expression VisitBinaryExpression(Ast.BinaryExpression expression)
- {
- this.Visit(expression.Left);
- this.Visit(expression.Right);
-
- return expression;
- }
-
- public virtual Ast.Expression VisitMemberExpression(Ast.MemberExpression expression)
- {
- return expression;
- }
-
- public virtual Ast.Expression VisitLiteralExpression(Ast.LiteralExpression expression)
- {
- return expression;
- }
-
- public virtual Ast.Expression VisitOrderbyExpression(Ast.OrderbyExpression expression)
- {
- return expression;
- }
-
- }
-}
diff --git a/LinqExtender/LinqExtender.PackLib/LinqExtender.PackLib.csproj b/LinqExtender/LinqExtender.PackLib/LinqExtender.PackLib.csproj
deleted file mode 100755
index 1b9cd4fe..00000000
--- a/LinqExtender/LinqExtender.PackLib/LinqExtender.PackLib.csproj
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {8A5B4179-FAAC-40B9-B844-CCA926165327}
- Library
- Properties
- LinqExtender.PackLib
- LinqExtender.PackLib
- v4.0
- 512
-
-
- true
- full
- false
- bin\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {A2171F32-6AB4-4BA4-920B-EB1D28F5F7F2}
- LinqExtender
-
-
-
-
- Always
- Designer
-
-
-
-
-
- "$(SolutionDir)Tools\NuGet.exe" pack "LinqExtender.nuspec"
-
-
-
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.PackLib/LinqExtender.PackLib.csproj.user b/LinqExtender/LinqExtender.PackLib/LinqExtender.PackLib.csproj.user
deleted file mode 100755
index 566c009a..00000000
--- a/LinqExtender/LinqExtender.PackLib/LinqExtender.PackLib.csproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- ShowAllFiles
-
-
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.PackLib/LinqExtender.nuspec b/LinqExtender/LinqExtender.PackLib/LinqExtender.nuspec
deleted file mode 100755
index ffe384cc..00000000
--- a/LinqExtender/LinqExtender.PackLib/LinqExtender.nuspec
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- LinqExtender
- 3.0.1
- Mehfuz Hossain
- A toolkit for building custom LINQ providers.
- en-US
- http://mehfuzh.github.com/LinqExtender/
- http://www.opensource.org/licenses/mit-license.php
- LINQ LinqExtender custom-provider
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.PackLib/Properties/AssemblyInfo.cs b/LinqExtender/LinqExtender.PackLib/Properties/AssemblyInfo.cs
deleted file mode 100755
index 6c3a1f0d..00000000
--- a/LinqExtender/LinqExtender.PackLib/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("LinqExtender.PackLib")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("LinqExtender.PackLib")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("542ab0fe-002c-46be-9ec3-edb307690888")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/LinqExtender/LinqExtender.Silverlight/LinqExtender.Silverlight.csproj b/LinqExtender/LinqExtender.Silverlight/LinqExtender.Silverlight.csproj
deleted file mode 100755
index f898c172..00000000
--- a/LinqExtender/LinqExtender.Silverlight/LinqExtender.Silverlight.csproj
+++ /dev/null
@@ -1,245 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.50727
- 2.0
- {C3EA3FA4-C790-413D-A2D9-F59E8767CD9B}
- {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- LinqExtender.Silverlight
- LinqExtender.Silverlight
- Silverlight
- v3.0
- $(TargetFrameworkVersion)
- false
- true
- true
-
-
-
- v3.5
-
-
- true
- full
- false
- ..\bin\Debug\SL4\
- DEBUG;TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
- ..\bin\Debug\SL4\LinqExtender.Silverlight.XML
-
-
- pdbonly
- true
- Bin\Release\SL4\
- TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
- Bin\Release\SL4\LinqExtender.Silverlight.XML
-
-
-
-
-
-
-
-
-
-
-
-
- Abstraction\IBucket.cs
-
-
- Abstraction\IClassGenerator.cs
-
-
- Abstraction\IContainer.cs
-
-
- Abstraction\IMethodCall.cs
-
-
- Abstraction\IModifiableCollection.cs
-
-
- Abstraction\IQueryContextImpl.cs
-
-
- Abstraction\IQueryObject.cs
-
-
- Abstraction\IQueryObjectImpl.cs
-
-
- Abstraction\IVersionItem.cs
-
-
- Ast\BinaryExpression.cs
-
-
- Ast\BlockExpression.cs
-
-
- Ast\Expression.cs
-
-
- Ast\LambdaExpression.cs
-
-
- Ast\LiteralExpression.cs
-
-
- Ast\LogicalExpression.cs
-
-
- Ast\MemberExpression.cs
-
-
- Ast\MethodCallExpression.cs
-
-
- Ast\OrderbyExpression.cs
-
-
- Ast\TypeExpression.cs
-
-
- Attributes\IgnoreAttribute.cs
-
-
- Attributes\NameAttribute.cs
-
-
- Attributes\UniqueIdentifierAttribute.cs
-
-
- BinaryOperator.cs
-
-
- Bucket.cs
-
-
- BucketImpl.cs
-
-
- BucketItem.cs
-
-
- Buckets.cs
-
-
- ClassGenerator.cs
-
-
- CodeType.cs
-
-
- Collection\QueryCollection.cs
-
-
- Collection\ReadOnlyQueryCollection.cs
-
-
- ExpressionVisitor.cs
-
-
- Fluent\FluentBucket.cs
-
-
- Fluent\FluentEntity.cs
-
-
- Fluent\FluentExpressionTree.cs
-
-
- Fluent\FluentIterator.cs
-
-
- Fluent\FluentMethod.cs
-
-
- IQueryContext.cs
-
-
- LogicalOperator.cs
-
-
- MemberReference.cs
-
-
- Messages.Designer.cs
-
-
- MethodCall.cs
-
-
- MethodNames.cs
-
-
- ProjectedQuery.cs
-
-
- ProviderException.cs
-
-
- Query.cs
-
-
- Queryable.cs
-
-
- QueryContextImpl.cs
-
-
- QueryItemComparer.cs
-
-
- QueryObject.cs
-
-
- QueryProvider.cs
-
-
- TreeNode.cs
-
-
- TypeReference.cs
-
-
- Utility.cs
-
-
-
-
-
-
- Messages.resx
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Silverlight/Properties/AssemblyInfo.cs b/LinqExtender/LinqExtender.Silverlight/Properties/AssemblyInfo.cs
deleted file mode 100644
index c54b470b..00000000
--- a/LinqExtender/LinqExtender.Silverlight/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("LinqExtender.Silverlight")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("LinqExtender.Silverlight")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("cf451b51-20ef-40d5-9b66-6dff6d7c3e2e")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/LinqExtender/LinqExtender.Tests/BaseFixture.cs b/LinqExtender/LinqExtender.Tests/BaseFixture.cs
deleted file mode 100644
index c82bc7cc..00000000
--- a/LinqExtender/LinqExtender.Tests/BaseFixture.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Diagnostics;
-using System.Reflection;
-using System.IO;
-using NUnit.Framework;
-using System.Text.RegularExpressions;
-
-namespace LinqExtender.Tests
-{
- public class BaseFixture
- {
- protected string Expected()
- {
- var frame = new StackTrace(1).GetFrame(0);
-
- // get the target test method.
- var targetMethod = frame.GetMethod();
-
- var expected = ReadResult(targetMethod.Name);
- return expected;
- }
-
- protected string Source(StringBuilder builder)
- {
- string content = builder.ToString();
- return Regex.Replace(content, "[\r\n\t]", string.Empty);
- }
-
- private string ReadResult(string testname)
- {
- Assembly assembly = Assembly.GetExecutingAssembly();
-
- using (Stream stream = assembly.GetManifestResourceStream(String.Format("LinqExtender.Tests.Cases.{0}.txt", testname)))
- {
- using (StreamReader reader = new StreamReader(stream))
- {
- string content = reader.ReadToEnd();
- return Regex.Replace(content, "[\r\n\t]", string.Empty);
- }
- }
- }
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/Book.cs b/LinqExtender/LinqExtender.Tests/Book.cs
deleted file mode 100644
index dc5028c1..00000000
--- a/LinqExtender/LinqExtender.Tests/Book.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-
-namespace LinqExtender.Tests
-{
- public class Book
- {
- public string Author { get; set; }
-
- public string Title { get; set; }
-
- public string ISBN { get; set; }
-
- public DateTime? LastUpdated { get; set; }
-
- ///
- /// Identity inherits Unique Attribute, these will be useful for update query.
- ///
- public int Id { get; set; }
- public bool IsAvailable { get; set; }
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertObjectNameAsSpecifiedInNameAttribute.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertObjectNameAsSpecifiedInNameAttribute.txt
deleted file mode 100644
index 4e774231..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertObjectNameAsSpecifiedInNameAttribute.txt
+++ /dev/null
@@ -1 +0,0 @@
-select * from ext_library
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertOrderByDescending.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertOrderByDescending.txt
deleted file mode 100644
index f870a2a2..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertOrderByDescending.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-select * from Book
-order by Book.Author desc
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertPropertyNameAsSpeficiedInNameAttribute.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertPropertyNameAsSpeficiedInNameAttribute.txt
deleted file mode 100644
index 29cae0fe..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertPropertyNameAsSpeficiedInNameAttribute.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from ext_library
-where
-ext_library.lb_Id = 2
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleOrderBySelect.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleOrderBySelect.txt
deleted file mode 100644
index f875e742..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleOrderBySelect.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-select * from Book
-order by Book.Author asc
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleSelect.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleSelect.txt
deleted file mode 100644
index 2936e225..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleSelect.txt
+++ /dev/null
@@ -1 +0,0 @@
-select * from Book
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereClause.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereClause.txt
deleted file mode 100644
index 9ba3e407..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereClause.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-Book.Id = 1
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereThatHasMethodCall.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereThatHasMethodCall.txt
deleted file mode 100644
index 01b9c150..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereThatHasMethodCall.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-Book.Author = "Tom"
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereWithLogicalExpression.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereWithLogicalExpression.txt
deleted file mode 100644
index 5f1cd8aa..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertSimpleWhereWithLogicalExpression.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-Book.Id = 1 AND Book.Author = "Charlie"
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithNestedLeftAndRightLogicaExpression.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithNestedLeftAndRightLogicaExpression.txt
deleted file mode 100644
index 249f0713..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithNestedLeftAndRightLogicaExpression.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-(Book.Id = 10 AND Book.Author = "Plarosi") OR (Book.Id = 1 AND Book.Author = "Charlie")
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithNestedLeftLogicalExpression.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithNestedLeftLogicalExpression.txt
deleted file mode 100644
index 10f8408f..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithNestedLeftLogicalExpression.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-(Book.Id = 1 AND Book.Author = "Charlie") OR Book.Id = 10
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithtNestedRightLogicalExpression.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithtNestedRightLogicalExpression.txt
deleted file mode 100644
index a87dbaa1..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldAssertWhereWithtNestedRightLogicalExpression.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-Book.Id = 10 OR (Book.Id = 1 AND Book.Author = "Charlie")
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldConcatMultipleWhereCallsWithLogicalAnd.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldConcatMultipleWhereCallsWithLogicalAnd.txt
deleted file mode 100644
index f6822f0a..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldConcatMultipleWhereCallsWithLogicalAnd.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-Book.Id = 1 AND Book.Author = "Scott"
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/Cases/ShouldJoinWhereUsingAndWhenNextCallHavingLogicalExpr.txt b/LinqExtender/LinqExtender.Tests/Cases/ShouldJoinWhereUsingAndWhenNextCallHavingLogicalExpr.txt
deleted file mode 100644
index 6b7ab387..00000000
--- a/LinqExtender/LinqExtender.Tests/Cases/ShouldJoinWhereUsingAndWhenNextCallHavingLogicalExpr.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-select * from Book
-where
-Book.ISBN = "111" AND ((Book.Id = 1 OR Book.Author = "Scott") OR Book.IsAvailable = True)
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/CustomAttributeTest.cs b/LinqExtender/LinqExtender.Tests/CustomAttributeTest.cs
deleted file mode 100644
index bc4a3e72..00000000
--- a/LinqExtender/LinqExtender.Tests/CustomAttributeTest.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using NUnit.Framework;
-
-namespace LinqExtender.Tests
-{
- [TestFixture]
- public class CustomAttributeTest : BaseFixture
- {
- [Test]
- public void ShouldAssertObjectNameAsSpecifiedInNameAttribute()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from libary in context
- select libary;
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertPropertyNameAsSpeficiedInNameAttribute()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from libary in context
- where libary.Id == 2
- select libary;
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/ExecutionFixture.cs b/LinqExtender/LinqExtender.Tests/ExecutionFixture.cs
deleted file mode 100755
index 3b1d2148..00000000
--- a/LinqExtender/LinqExtender.Tests/ExecutionFixture.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using NUnit.Framework;
-using System.Linq.Expressions;
-
-namespace LinqExtender.Tests
-{
- [TestFixture]
- public class ExecutionFixture
- {
- [Test]
- public void ShouldAssertExpectedResultFromGivenContext()
- {
- var query = from book in new FakeContext(GetBooks())
- where book.Id == 2
- select book;
-
- Assert.AreEqual(2, query.First().Id);
- }
-
- [Test]
- public void ShouldAssertProjectionSelect()
- {
- var query = new FakeContext(GetBooks())
- .Where(book => book.Id == 2)
- .Select(r => new { r.Id, r.Title });
-
- Assert.AreEqual(2, query.First().Id);
- }
-
- [Test]
- public void ShouldAssertTakeAndSkip()
- {
- var query = (from book in new FakeContext(GetBooks())
- where book.Id == 2
- select book).Take(1).Skip(0);
-
- Assert.AreEqual(2, query.First().Id);
- }
-
- [Test]
- public void ShouldNotCacheTakeOrSkipFromPreviousContext()
- {
- var expected = (from book in new FakeContext(GetBooks())select book).Skip(1).Take(1).ToArray();
- var actual = (from book in new FakeContext(GetBooks()) select book).ToArray();
-
- Assert.AreNotEqual(expected.Count(), actual.Count());
- }
-
- internal class FakeContext : ExpressionVisitor, IQueryContext
- {
- internal FakeContext(IList source)
- {
- this.source = source;
- this.methodCalls = new List();
- }
-
- public IEnumerable Execute(Ast.Expression expression)
- {
- this.Visit(expression);
-
- var result = source.AsQueryable();
-
- if (this.expression != null)
- {
- var lambda = Expression.Lambda(this.expression, new[] { parameter });
- var func = (Func)lambda.Compile();
- result = source.Where(func).AsQueryable();
- }
-
- foreach (var methodCall in methodCalls)
- {
- var parameters = new Expression[methodCall.Paramters.Length + 1];
-
- parameters[0] = Expression.Constant(result);
-
- for (int index = 0; index < methodCall.Paramters.Length; index++)
- {
- parameters[index + 1] = Expression.Constant(methodCall.Paramters[index].Value, methodCall.Paramters[index].Type);
- }
-
- var exp = Expression.Call(methodCall.Method, parameters);
-
- result = (IQueryable)Expression.Lambda(exp).Compile().DynamicInvoke();
- }
- return result.AsEnumerable();
- }
-
- public override Ast.Expression VisitTypeExpression(Ast.TypeExpression expression)
- {
- parameter = Expression.Parameter(expression.Type.UnderlyingType, "x");
- return expression;
- }
-
- public override Ast.Expression VisitBinaryExpression(Ast.BinaryExpression expression)
- {
- this.Visit(expression.Left);
-
- var left = this.expression;
-
- this.Visit(expression.Right);
-
- var right = this.expression;
-
- this.expression = Expression.MakeBinary(ExpressionType.Equal, left, right);
-
- return expression;
- }
-
- public override Ast.Expression VisitMemberExpression(Ast.MemberExpression expression)
- {
- this.expression = Expression.MakeMemberAccess(parameter, expression.Member.MemberInfo);
- return expression;
- }
-
- public override Ast.Expression VisitLiteralExpression(Ast.LiteralExpression expression)
- {
- this.expression = Expression.Constant(expression.Value, expression.Type.UnderlyingType);
- return expression;
- }
-
- public override Ast.Expression VisitMethodCallExpression(Ast.MethodCallExpression expression)
- {
- methodCalls.Add(expression);
- return expression;
- }
-
- private readonly IList source;
- private Expression expression;
- private IList methodCalls;
- private ParameterExpression parameter;
- }
-
- public IList GetBooks()
- {
- IList books = new List();
-
- books.Add(new Book { Id = 1, Author = "Scott" });
- books.Add(new Book { Id = 2, Author = "John" });
-
- return books;
-
- }
- }
-
-}
diff --git a/LinqExtender/LinqExtender.Tests/ExpressionVisitor.cs b/LinqExtender/LinqExtender.Tests/ExpressionVisitor.cs
deleted file mode 100644
index ad4713db..00000000
--- a/LinqExtender/LinqExtender.Tests/ExpressionVisitor.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-
-namespace LinqExtender.Tests
-{
- public class ExpressionVisitor
- {
- internal Ast.Expression Visit(Ast.Expression expression)
- {
- switch (expression.CodeType)
- {
- case CodeType.BlockExpression:
- return VisitBlockExpression((Ast.BlockExpression)expression);
- case CodeType.TypeExpression:
- return VisitTypeExpression((Ast.TypeExpression)expression);
- case CodeType.LambdaExpresion:
- return VisitLambdaExpression((Ast.LambdaExpression)expression);
- case CodeType.LogicalExpression:
- return VisitLogicalExpression((Ast.LogicalExpression)expression);
- case CodeType.BinaryExpression:
- return VisitBinaryExpression((Ast.BinaryExpression)expression);
- case CodeType.LiteralExpression:
- return VisitLiteralExpression((Ast.LiteralExpression)expression);
- case CodeType.MemberExpression:
- return VisitMemberExpression((Ast.MemberExpression)expression);
- case CodeType.OrderbyExpression:
- return VisitOrderbyExpression((Ast.OrderbyExpression)expression);
- case CodeType.MethodCallExpression:
- return VisitMethodCallExpression((Ast.MethodCallExpression)expression);
- }
-
- throw new ArgumentException("Expression type is not supported");
- }
-
- public virtual Ast.Expression VisitTypeExpression(Ast.TypeExpression typeExpression)
- {
- return typeExpression;
- }
-
- public virtual Ast.Expression VisitBlockExpression(Ast.BlockExpression blockExpression)
- {
- foreach (var expression in blockExpression.Expressions)
- this.Visit(expression);
-
- return blockExpression;
- }
-
- public virtual Ast.Expression VisitMethodCallExpression(Ast.MethodCallExpression methodCallExpression)
- {
- return methodCallExpression;
- }
-
- public virtual Ast.Expression VisitLogicalExpression(Ast.LogicalExpression expression)
- {
- this.Visit(expression.Left);
- this.Visit(expression.Right);
- return expression;
- }
-
- public virtual Ast.Expression VisitLambdaExpression(Ast.LambdaExpression expression)
- {
- if (expression.Body != null)
- return this.Visit(expression.Body);
- return expression;
- }
-
- public virtual Ast.Expression VisitBinaryExpression(Ast.BinaryExpression expression)
- {
- this.Visit(expression.Left);
- this.Visit(expression.Right);
-
- return expression;
- }
-
- public virtual Ast.Expression VisitMemberExpression(Ast.MemberExpression expression)
- {
- return expression;
- }
-
- public virtual Ast.Expression VisitLiteralExpression(Ast.LiteralExpression expression)
- {
- return expression;
- }
-
- public virtual Ast.Expression VisitOrderbyExpression(Ast.OrderbyExpression expression)
- {
- return expression;
- }
-
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/ITextWriter.cs b/LinqExtender/LinqExtender.Tests/ITextWriter.cs
deleted file mode 100644
index a4a61f24..00000000
--- a/LinqExtender/LinqExtender.Tests/ITextWriter.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Tests
-{
- public interface ITextWriter
- {
- void Write(object value);
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/Library.cs b/LinqExtender/LinqExtender.Tests/Library.cs
deleted file mode 100644
index b5e3ff46..00000000
--- a/LinqExtender/LinqExtender.Tests/Library.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using LinqExtender.Attributes;
-
-namespace LinqExtender.Tests
-{
- [Name("ext_library")]
- public class Library
- {
- [Name("lb_Id")]
- public int Id { get; set; }
- public string Name { get; set; }
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/LinqExtender.Tests.csproj b/LinqExtender/LinqExtender.Tests/LinqExtender.Tests.csproj
deleted file mode 100644
index ccdad814..00000000
--- a/LinqExtender/LinqExtender.Tests/LinqExtender.Tests.csproj
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {BA30AD53-4E10-4610-BDD2-BB823DF0325B}
- Library
- Properties
- LinqExtender.Tests
- LinqExtender.Tests
- v3.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- False
- ..\ThirdParty\nunit.framework.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {A2171F32-6AB4-4BA4-920B-EB1D28F5F7F2}
- LinqExtender
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.Tests/LinqExtender.Tests.pidb b/LinqExtender/LinqExtender.Tests/LinqExtender.Tests.pidb
deleted file mode 100644
index 330031db..00000000
Binary files a/LinqExtender/LinqExtender.Tests/LinqExtender.Tests.pidb and /dev/null differ
diff --git a/LinqExtender/LinqExtender.Tests/LinqQueryTest.cs b/LinqExtender/LinqExtender.Tests/LinqQueryTest.cs
deleted file mode 100644
index 3ce98b91..00000000
--- a/LinqExtender/LinqExtender.Tests/LinqQueryTest.cs
+++ /dev/null
@@ -1,190 +0,0 @@
-using System.Linq;
-using System.Text;
-using NUnit.Framework;
-using System;
-
-namespace LinqExtender.Tests
-{
- [TestFixture]
- public class LinqQueryTest : BaseFixture
- {
- [Test]
- public void ShouldAssertSimpleSelect()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- select book;
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertSimpleWhereClause()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- where book.Id == 1
- select book;
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertSimpleWhereWithLogicalExpression()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- where book.Id == 1 && book.Author == "Charlie"
- select book;
-
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
-
- }
-
- [Test]
- public void ShouldAssertWhereWithNestedLeftLogicalExpression()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- where (book.Id == 1 && book.Author == "Charlie")
- || book.Id == 10
- select book;
-
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertWhereWithtNestedRightLogicalExpression()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- where book.Id == 10 || (book.Id == 1 && book.Author == "Charlie")
- select book;
-
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertWhereWithNestedLeftAndRightLogicaExpression()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- where (book.Id == 10 && book.Author == "Plarosi") || (book.Id == 1 && book.Author == "Charlie")
- select book;
-
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertSimpleOrderBySelect()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- orderby book.Author
- select book;
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertOrderByDescending()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- orderby book.Author descending
- select book;
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldAssertSimpleWhereThatHasMethodCall()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = from book in context
- where book.Author == GetAuthor(1)
- select book;
-
- query.Count();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldConcatMultipleWhereCallsWithLogicalAnd()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = context.Where(x => x.Id == 1).Where(x => x.Author == "Scott");
-
- query.FirstOrDefault();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- [Test]
- public void ShouldJoinWhereUsingAndWhenNextCallHavingLogicalExpr()
- {
- var builder = new StringBuilder();
- var context = new TextContext(new StringWriter(builder));
-
- var query = context
- .Where(x => x.ISBN == "111")
- .Where(x => x.Id == 1 || x.Author == "Scott" || x.IsAvailable);
-
-
- query.FirstOrDefault();
-
- Assert.AreEqual(Expected(), Source(builder));
- }
-
- // Fake method to test the capability of using
- // method call in the query.
- private string GetAuthor(int bookId)
- {
- if (bookId > 0)
- return "Tom";
-
- throw new ArgumentException("Not a valid book id");
- }
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/Properties/AssemblyInfo.cs b/LinqExtender/LinqExtender.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index ec0d0b3b..00000000
--- a/LinqExtender/LinqExtender.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("LinqExtender.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("LinqExtender.Tests")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("dcc38c75-2fab-4727-858a-751817daeb49")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/LinqExtender/LinqExtender.Tests/StringWriter.cs b/LinqExtender/LinqExtender.Tests/StringWriter.cs
deleted file mode 100644
index 009033c4..00000000
--- a/LinqExtender/LinqExtender.Tests/StringWriter.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace LinqExtender.Tests
-{
- public class StringWriter : ITextWriter
- {
- public StringWriter(StringBuilder builder)
- {
- this.builder = builder;
- }
-
- public void Write(object value)
- {
- builder.Append(value);
- }
-
- private StringBuilder builder;
- }
-}
diff --git a/LinqExtender/LinqExtender.Tests/TextContext.cs b/LinqExtender/LinqExtender.Tests/TextContext.cs
deleted file mode 100755
index 12f10f8f..00000000
--- a/LinqExtender/LinqExtender.Tests/TextContext.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-
-namespace LinqExtender.Tests
-{
- public class TextContext : ExpressionVisitor, IQueryContext
- {
- public TextContext(ITextWriter writer)
- {
- this.writer = writer;
- }
-
- public IEnumerable Execute(Ast.Expression expression)
- {
- this.Visit(expression);
- return new List().AsEnumerable();
- }
-
- public override Ast.Expression VisitTypeExpression(Ast.TypeExpression expression)
- {
- writer.Write(string.Format("select * from {0}", expression.Type.Name));
- return expression;
- }
-
- public override Ast.Expression VisitLambdaExpression(Ast.LambdaExpression expression)
- {
- WriteNewLine();
- writer.Write("where");
- WriteNewLine();
-
- this.Visit(expression.Body);
-
- return expression;
- }
-
- public override Ast.Expression VisitBinaryExpression(Ast.BinaryExpression expression)
- {
- this.Visit(expression.Left);
- writer.Write(GetBinaryOperator(expression.Operator));
- this.Visit(expression.Right);
-
- return expression;
- }
-
- public override Ast.Expression VisitLogicalExpression(Ast.LogicalExpression expression)
- {
- WriteTokenIfReq(expression, Token.LeftParenthesis);
-
- this.Visit(expression.Left);
-
- WriteLogicalOperator(expression.Operator);
-
- this.Visit(expression.Right);
-
- WriteTokenIfReq(expression, Token.RightParentThesis);
-
- return expression;
- }
-
- public override Ast.Expression VisitMemberExpression(Ast.MemberExpression expression)
- {
- writer.Write(expression.FullName);
- return expression;
- }
-
- public override Ast.Expression VisitLiteralExpression(Ast.LiteralExpression expression)
- {
- WriteValue(expression.Type, expression.Value);
- return expression;
- }
-
- public override Ast.Expression VisitOrderbyExpression(Ast.OrderbyExpression expression)
- {
- WriteNewLine();
- Write(string.Format("order by {0}.{1} {2}",
- expression.Member.DeclaringType.Name,
- expression.Member.Name,
- expression.Ascending ? "asc" : "desc"));
- WriteNewLine();
-
- return expression;
- }
-
- private static string GetBinaryOperator(BinaryOperator @operator)
- {
- switch (@operator)
- {
- case BinaryOperator.Equal:
- return " = ";
- }
- throw new ArgumentException("Invalid binary operator");
- }
-
- private void WriteLogicalOperator(LogicalOperator logicalOperator)
- {
- WriteSpace();
-
- writer.Write(logicalOperator.ToString().ToUpper());
-
- WriteSpace();
- }
-
- private void WriteSpace()
- {
- writer.Write(" ");
- }
-
- private void WriteNewLine()
- {
- writer.Write(Environment.NewLine);
- }
-
- private void WriteTokenIfReq(Ast.LogicalExpression expression, Token token)
- {
- if (expression.IsChild)
- {
- WriteToken(token);
- }
- }
-
- private void WriteToken(Token token)
- {
- switch (token)
- {
- case Token.LeftParenthesis:
- writer.Write("(");
- break;
- case Token.RightParentThesis:
- writer.Write(")");
- break;
- }
- }
-
- public enum Token
- {
- LeftParenthesis,
- RightParentThesis
- }
-
- private void WriteValue(TypeReference type, object value)
- {
- if (type.UnderlyingType == typeof(string))
- writer.Write(String.Format("\"{0}\"", value));
- else
- writer.Write(value);
- }
-
- private void Write(string value)
- {
- writer.Write(value);
- }
-
- public ITextWriter writer;
- public bool parameter;
- }
-}
diff --git a/LinqExtender/LinqExtender.csproj b/LinqExtender/LinqExtender.csproj
deleted file mode 100644
index 79351f5f..00000000
--- a/LinqExtender/LinqExtender.csproj
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- {2A308072-1B8C-44F6-B4C7-4FB8D4D9A949}
- Library
- LinqExtender
- LinqExtender
- Profile78
- v4.5
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- false
-
-
- full
- true
- bin\Release
- prompt
- 4
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ..\packages\NUnit.2.6.4\lib\nunit.framework.dll
-
-
-
\ No newline at end of file
diff --git a/LinqExtender/LinqExtender.pidb b/LinqExtender/LinqExtender.pidb
deleted file mode 100644
index 4d1e9cf1..00000000
Binary files a/LinqExtender/LinqExtender.pidb and /dev/null differ
diff --git a/LinqExtender/LogicalOperator.cs b/LinqExtender/LogicalOperator.cs
deleted file mode 100644
index e3e7122b..00000000
--- a/LinqExtender/LogicalOperator.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace LinqExtender
-{
- ///
- /// Type of operator used in where clause.
- ///
- public enum LogicalOperator
- {
- ///
- /// Used for first item in where entry
- ///
- None,
- ///
- /// Used for
- ///
- And,
- ///
- /// Used for ||
- ///
- Or
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/MemberReference.cs b/LinqExtender/MemberReference.cs
deleted file mode 100644
index 8fd2062e..00000000
--- a/LinqExtender/MemberReference.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using LinqExtender.Attributes;
-
-namespace LinqExtender
-{
- ///
- /// Wraps and extends the instance.
- ///
- public class MemberReference
- {
- internal MemberReference(MemberInfo memberInfo)
- {
- this.memberInfo = memberInfo;
- }
-
- ///
- /// Get the decalaring type.
- ///
- public TypeReference DeclaringType
- {
- get
- {
- return new TypeReference(memberInfo.DeclaringType);
- }
- }
-
- ///
- /// Gets the name of the member, applies first.
- ///
- public string Name
- {
- get
- {
- var nameAtt = FindAttribute();
-
- if ((nameAtt != null))
- {
- return nameAtt.Name;
- }
- return this.memberInfo.Name;
- }
- }
-
- ///
- /// Gets the associated with the reference.
- ///
- public MemberInfo MemberInfo
- {
- get
- {
- return memberInfo;
- }
- }
-
- ///
- /// Finds the specific attribute from the member.
- ///
- /// Attribute to find
- /// Target attribute reference
- public T FindAttribute()
- {
- return (T)Utility.FindAttribute(typeof(T), memberInfo);
- }
-
- private readonly MemberInfo memberInfo;
- }
-}
diff --git a/LinqExtender/Messages.Designer.cs b/LinqExtender/Messages.Designer.cs
deleted file mode 100644
index b16b3714..00000000
--- a/LinqExtender/Messages.Designer.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace LinqExtender {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Messages {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Messages() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LinqExtender.Messages", typeof(Messages).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to Bucket translation failed during {0} call..
- ///
- internal static string BucketTranslationFailed {
- get {
- return ResourceManager.GetString("BucketTranslationFailed", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Could not find the nested property.
- ///
- internal static string CouldNotFindTheNestedProperty {
- get {
- return ResourceManager.GetString("CouldNotFindTheNestedProperty", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Direct join expression is not supported yet..
- ///
- internal static string DirectJoinNotSupported {
- get {
- return ResourceManager.GetString("DirectJoinNotSupported", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to There is no item in the collection..
- ///
- internal static string EmptyCollection {
- get {
- return ResourceManager.GetString("EmptyCollection", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Opps... Some error occured while executing the query. Please check the stack trace for more detail..
- ///
- internal static string ErrorWhileExecutingTheQuery {
- get {
- return ResourceManager.GetString("ErrorWhileExecutingTheQuery", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to There are multiple element in the collection, use First instead..
- ///
- internal static string MultipleElementInColleciton {
- get {
- return ResourceManager.GetString("MultipleElementInColleciton", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to There can only be one unique property under {0}..
- ///
- internal static string MustbeOneUniqueField {
- get {
- return ResourceManager.GetString("MustbeOneUniqueField", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Must contains valid settings information to process..
- ///
- internal static string MustContainValidSettingsXml {
- get {
- return ResourceManager.GetString("MustContainValidSettingsXml", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Must deifne a cotnainer and behavior of each node..
- ///
- internal static string MustDefineAContainer {
- get {
- return ResourceManager.GetString("MustDefineAContainer", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Entity class must have a default constructor..
- ///
- internal static string MustHaveADefaultConstructor {
- get {
- return ResourceManager.GetString("MustHaveADefaultConstructor", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Must provide a valid callback method..
- ///
- internal static string MustProvideACallback {
- get {
- return ResourceManager.GetString("MustProvideACallback", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Expression with multiple argumetns is not implemented. Ex. Join..
- ///
- internal static string NotImplemetedExpressionWithMultipleArguments {
- get {
- return ResourceManager.GetString("NotImplemetedExpressionWithMultipleArguments", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Unknown expression node type.
- ///
- internal static string UnknowNodeType {
- get {
- return ResourceManager.GetString("UnknowNodeType", resourceCulture);
- }
- }
- }
-}
diff --git a/LinqExtender/Messages.resources b/LinqExtender/Messages.resources
deleted file mode 100644
index fd173828..00000000
Binary files a/LinqExtender/Messages.resources and /dev/null differ
diff --git a/LinqExtender/Messages.resx b/LinqExtender/Messages.resx
deleted file mode 100644
index fc0ca63e..00000000
--- a/LinqExtender/Messages.resx
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Direct join expression is not supported yet.
-
-
- There is no item in the collection.
-
-
- There are multiple element in the collection, use First instead.
-
-
- There can only be one unique property under {0}.
-
-
- Must deifne a cotnainer and behavior of each node.
-
-
- Bucket translation failed during {0} call.
-
-
- Must provide a valid callback method.
-
-
- Must contains valid settings information to process.
-
-
- Entity class must have a default constructor.
-
-
- Unknown expression node type
-
-
- Expression with multiple argumetns is not implemented. Ex. Join.
-
-
- Opps... Some error occured while executing the query. Please check the stack trace for more detail.
-
-
- Could not find the nested property
- CouldNotFindTheNestedProperty description
-
-
\ No newline at end of file
diff --git a/LinqExtender/MethodCall.cs b/LinqExtender/MethodCall.cs
deleted file mode 100644
index 6c829f14..00000000
--- a/LinqExtender/MethodCall.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using System.Reflection;
-using System.Linq.Expressions;
-
-namespace LinqExtender
-{
- public class MethodCall
- {
- ///
- /// Initalizes the instance of class.
- ///
- /// Name of the method
- /// Method arguments.
- internal MethodCall(object target, MethodInfo methodInfo, Parameter[] parameters)
- {
- this.target = target;
- this.methodInfo = methodInfo;
- this.parameters = parameters;
- }
-
- ///
- /// Gets the target expression.
- ///
- public object Target
- {
- get
- {
- return target;
- }
- }
-
- ///
- /// Gets the underlying method info.
- ///
- public MethodInfo Method
- {
- get
- {
- return methodInfo;
- }
- }
-
- ///
- /// Gets the array of parameter.
- ///
- public Parameter[] Parameters
- {
- get
- {
- return parameters;
- }
- }
-
- public class Parameter
- {
- ///
- /// Initalizes the new instance of class.
- ///
- /// Type of the argument
- /// Value of the argument
- internal Parameter(Type type, object value)
- {
- this.type = type;
- this.value = value;
- }
-
- ///
- /// Gets the parameter value
- ///
- public object Value
- {
- get
- {
- return value;
- }
- }
-
- ///
- /// Gets the underlying type.
- ///
- public Type Type
- {
- get
- {
- return type;
- }
- }
-
-
- private readonly Type type;
- private readonly object value;
- }
-
-
- private readonly object target;
- private readonly MethodInfo methodInfo;
- private readonly Parameter[] parameters;
- }
-}
diff --git a/LinqExtender/MethodNames.cs b/LinqExtender/MethodNames.cs
deleted file mode 100644
index 925b7bfa..00000000
--- a/LinqExtender/MethodNames.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace LinqExtender
-{
- internal class MethodNames
- {
- public static string Group = "GroupBy";
- internal const string Join = "Join";
- internal const string Take = "Take";
- internal const string Skip = "Skip";
- internal const string Where = "Where";
- internal const string Select = "Select";
- internal const string Orderby = "OrderBy";
- internal const string ThenBy = "ThenBy";
- internal const string Orderbydesc = "OrderByDescending";
- }
-}
\ No newline at end of file
diff --git a/LinqExtender/MyClass.cs b/LinqExtender/MyClass.cs
deleted file mode 100644
index 1929bb5e..00000000
--- a/LinqExtender/MyClass.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace LinqExtender
-{
- public class MyClass
- {
- public MyClass ()
- {
- }
- }
-}
-
diff --git a/LinqExtender/ProjectedQuery.cs b/LinqExtender/ProjectedQuery.cs
deleted file mode 100644
index 90407ff2..00000000
--- a/LinqExtender/ProjectedQuery.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Collections;
-using LinqExtender.Collection;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender
-{
- internal class ProjectedQuery : ReadOnlyQueryCollection
, IQueryProvider, IQueryable
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The expression.
- /// The query.
- public ProjectedQuery(Expression expression, Query parent)
- {
- this.expression = expression;
- this.parent = parent;
- }
-
- #region IEnumerable Members
-
- ///
- /// Returns an enumerator that iterates through the collection.
- ///
- ///
- /// A that can be used to iterate through the collection.
- ///
- public IEnumerator GetEnumerator()
- {
- this.ExectuteParent();
- return Items.GetEnumerator();
- }
-
- public override Expression VisitMethodCall(MethodCallExpression expression)
- {
- foreach (var exp in expression.Arguments)
- this.Visit(exp);
-
- return expression;
- }
-
- public override Expression VisitLamda(LambdaExpression lambdaExpression)
- {
- lambda = lambdaExpression;
-
- return expression;
- }
-
- private void ExectuteParent()
- {
- Items.Clear();
-
- this.Visit(this.expression);
-
- try
- {
- ((Expression>)lambda).Compile();
- }
- catch
- {
- // do nothing for now.
- }
-
- var result = parent.Select(((Expression>)lambda).Compile());
-
- Items.AddRange(result);
- }
-
- #endregion
-
- #region IEnumerable Members
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return (this as IEnumerable).GetEnumerator();
- }
-
-
- #endregion
-
- #region IQueryable Members
-
- ///
- /// Gets the type of the element(s) that are returned when the expression tree associated with this instance of is executed.
- ///
- ///
- /// A that represents the type of the element(s) that are returned when the expression tree associated with this object is executed.
- public Type ElementType
- {
- get { return typeof(S); }
- }
-
- ///
- /// Gets the expression tree that is associated with the instance of .
- ///
- ///
- /// The that is associated with this instance of .
- public Expression Expression
- {
- get { return expression; }
- }
-
- ///
- /// Gets the query provider that is associated with this data source.
- ///
- ///
- /// The that is associated with this data source.
- public IQueryProvider Provider
- {
- get { return this; }
- }
-
- #endregion
-
- #region IQueryProvider Members
-
- public IQueryable CreateQuery(Expression expression)
- {
- return parent.CreateQuery(expression);
- }
-
- public IQueryable CreateQuery(Expression expression)
- {
- return parent.CreateQuery(expression);
- }
-
- public TResult Execute(Expression expression)
- {
- return (TResult)this.ExecuteNonGeneric(expression);
- }
-
- public object Execute(Expression expression)
- {
- return (S)this.ExecuteNonGeneric(expression);
- }
-
- public object ExecuteNonGeneric(Expression expression)
- {
- ExectuteParent();
-
- if (expression is MethodCallExpression)
- {
- var mCallExp = (MethodCallExpression)expression;
- // when first , last or single is called
- string methodName = mCallExp.Method.Name;
-
- /* Try for Generics Results */
- Type itemType = typeof(IMethodCall);
-
- object obj = Utility.InvokeMethod(methodName, itemType, this);
-
- /* Try for Non Generics Result */
- if (obj == null)
- {
- itemType = typeof(IMethodCall);
- obj = Utility.InvokeMethod(methodName, itemType, this);
- }
- return obj;
-
- }
- return null;
- }
-
-
- #endregion
-
- private readonly Query parent;
- private LambdaExpression lambda;
- private readonly Expression expression;
- }
-}
-
diff --git a/LinqExtender/Properties/AssemblyInfo.cs b/LinqExtender/Properties/AssemblyInfo.cs
deleted file mode 100644
index 3c4a2408..00000000
--- a/LinqExtender/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle ("LinqExtender")]
-[assembly: AssemblyDescription ("")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("edward")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion ("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
diff --git a/LinqExtender/ProviderException.cs b/LinqExtender/ProviderException.cs
deleted file mode 100644
index 990d4ebb..00000000
--- a/LinqExtender/ProviderException.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-
-namespace LinqExtender
-{
- ///
- /// Custom extender expection class.
- ///
- public class ProviderException : Exception
- {
- ///
- /// Parametrized constructor for the expection.
- ///
- ///
- ///
- public ProviderException(string message, Exception ex) : base(message, ex) { }
- ///
- /// Defautl constructor for the expection.
- ///
- ///
- public ProviderException(string message) : base(message) { }
- }
-}
diff --git a/LinqExtender/Query.cs b/LinqExtender/Query.cs
deleted file mode 100644
index f59ab333..00000000
--- a/LinqExtender/Query.cs
+++ /dev/null
@@ -1,1170 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using LinqExtender.Attributes;
-using LinqExtender.Collection;
-using LinqExtender.Abstraction;
-
-namespace LinqExtender
-{
- ///
- /// Entry class for LINQ provider. Containter of the virtual methods that will be invoked on select, intsert, update, remove or get calls.
- ///
- public class Query : ExpressionVisitor, IModifiableCollection, IOrderedQueryable, IDisposable, IQueryProvider
- {
- ///
- /// Creates a new instance of class.
- ///
- public Query(IQueryContext context)
- {
- this.context = new QueryContextImpl(context);
- }
-
- ///
- /// Gets the current context associated with the provider.
- ///
- internal IQueryContextImpl Context
- {
- get
- {
- return context;
- }
- }
-
- ///
- /// Gets the collection item for an index
- ///
- /// index
- ///
- public T this[int index]
- {
- get
- {
- return ((QueryCollection)context.Collection).Items[index];
- }
- }
-
- #region IEnumerable Members
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return (this as IQueryable).Provider.Execute>(currentExpression).GetEnumerator();
- }
-
- #endregion
-
- #region IQueryable Members
- ///
- /// Gets element type for the expression.
- ///
- public Type ElementType
- {
- get { return typeof(T); }
- }
- ///
- /// Gets the expression tree.
- ///
- public Expression Expression
- {
- get
- {
- return Expression.Constant(this);
- }
- }
- ///
- /// Gets a query provider the LINQ query.
- ///
- public IQueryProvider Provider
- {
- get
- {
- return this;
- }
- }
-
- #endregion
-
- #region IEnumerable- Members
-
- ///
- /// Executes the query and gets a iterator for it.
- ///
- ///
- public IEnumerator GetEnumerator()
- {
- return (this as IQueryable).Provider.Execute>(currentExpression).GetEnumerator();
- }
-
- #endregion
-
- #region IQueryProvider Members
-
- ///
- /// Creates the query for type and current expression.
- ///
- /// currenty type passed by frameowrk
- ///
- ///
- public IQueryable CreateQuery(Expression expression)
- {
- // make sure there are no previous items left in the collection.
- if ((int)this.Count() > 0) this.Clear();
-
- this.currentExpression = expression;
- var curentMethodcall = currentExpression as MethodCallExpression;
-
- if (curentMethodcall != null)
- {
- string methodName = curentMethodcall.Method.Name;
- if (methodName == MethodNames.Join)
- {
- throw new ProviderException(Messages.DirectJoinNotSupported);
- }
-
- if (IsOnQueryMethodCall(curentMethodcall.Method))
- {
- var args = new MethodCall.Parameter[curentMethodcall.Arguments.Count - 1];
-
- int index = 0;
-
- foreach (var arg in args)
- {
- var argument = curentMethodcall.Arguments[index + 1];
-
- this.Visit(argument);
- args[index] = new MethodCall.Parameter(argument.Type, this.value);
-
- index++;
- }
-
- var target = (curentMethodcall.Arguments[0] as ConstantExpression).Value;
- // just append the method here.
- Buckets.Current.Methods.Add(new MethodCall(target, curentMethodcall.Method, args));
- }
- else
- {
- // Create a new bucket when Query.Execute is called or it is empty for current type.
- if ((!Buckets.ContainsKey(typeof(T))) || Buckets.Current.Processed)
- {
- Buckets.Current = BucketImpl.NewInstance.Init();
- }
-
- this.Visit(curentMethodcall);
- }
- }
-
- if (typeof(T) != typeof(TS))
- {
- projectedQuery = new ProjectedQuery(expression, this);
-
- return (IQueryable)projectedQuery;
- }
-
- return (IQueryable)this;
- }
-
- private bool IsOnQueryMethodCall(MethodInfo methodInfo)
- {
- bool result = methodInfo.Name == MethodNames.Take;
-
- result |= methodInfo.Name == MethodNames.Skip;
-
- return result;
- }
-
- ///
- /// Creates the query for current expression.
- ///
- ///
- /// ref to IQueryable instance
- public IQueryable CreateQuery(Expression expression)
- {
- return (this as IQueryProvider).CreateQuery(expression);
- }
-
- ///
- /// Executes the query for current type and expression
- ///
- /// Current type
- ///
- /// typed result
- public TResult Execute(Expression expression)
- {
- return (TResult)(this as IQueryProvider).Execute(expression);
- }
-
- ///
- /// Executes the query for current expression.
- ///
- ///
- /// object/collection
- public object Execute(Expression expression)
- {
- if (expression == null)
- {
- // do a generic select;
- //expression = (this as IEnumerable).Select(x=> x).Expression;
- }
-
- ProcessItem(Buckets.Current);
-
- if (expression is MethodCallExpression)
- {
- var mCallExp = (MethodCallExpression)expression;
-
- // when first , last or single is called
- string methodName = mCallExp.Method.Name;
-
- Type itemGenericType = typeof(IMethodCall);
- Type itemNonGenericType = typeof(IMethodCall);
-
- if (mCallExp.Method.ReturnType == typeof(T))
- {
- return Utility.InvokeMethod(methodName, itemGenericType, this);
- }
-
- /* Try for Non Generics Result */
- object obj = Utility.InvokeMethod(methodName, itemNonGenericType, this);
-
- if (obj != null)
- {
- return obj;
- }
-
- }
-
- return ((QueryCollection)context.Collection).Items;
- }
-
- #endregion
-
-
- #region Implementation of IQuery
-
- ///
- /// Returns a single item from the collection.
- ///
- ///
- public T Single()
- {
- return context.Collection.Single();
- }
-
- ///
- /// Returns a single item or default value if empty.
- ///
- ///
- public T SingleOrDefault()
- {
- return context.Collection.SingleOrDefault();
- }
-
- ///
- /// Returns the first item from the collection.
- ///
- ///
- public T First()
- {
- return context.Collection.First();
- }
-
- ///
- /// Returns first item or default value if empty.
- ///
- ///
- public T FirstOrDefault()
- {
- return context.Collection.FirstOrDefault();
- }
-
- ///
- /// Returns the last item from the collection.
- ///
- ///
- public T Last()
- {
- return context.Collection.Last();
- }
-
- ///
- /// Returns last item or default value if empty.
- ///
- ///
- public T LastOrDefault()
- {
- return context.Collection.LastOrDefault();
- }
-
- #endregion
-
- #region Implementation of IQuery
-
- ///
- /// Return true if there is any item in collection.
- ///
- ///
- public bool Any()
- {
- return context.Collection.Any();
- }
-
- ///
- /// Returns the count of items in the collection.
- ///
- ///
- public object Count()
- {
- return context.Collection.Count();
- }
-
- #endregion
-
- #region IDisposable Members
-
- void IDisposable.Dispose()
- {
- // clean up expression object from memory.
- if (this.currentExpression != null)
- {
- currentExpression = null;
- }
- Buckets.Clear();
-
- Clear();
- }
-
- #endregion
-
- ///
- /// Clears out items from collection.
- ///
- public void Clear()
- {
- context.Collection.Clear();
- }
-
- ///
- /// internally tries to sort , if the query contains orderby statement.
- ///
- public void Sort()
- {
- if (Buckets.Current.OrderByItems != null)
- {
- foreach (var orderByInfo in Buckets.Current.OrderByItems)
- {
- ((QueryCollection)context.Collection)
- .Sort(new QueryItemComparer>(orderByInfo.Member.MemberInfo.Name, orderByInfo.IsAscending));
- }
- }
- }
-
- ///
- /// Marks an item to be removed.
- ///
- /// query object.
- public void Remove(T value)
- {
- context.Collection.Remove(value);
- }
-
- ///
- /// Addes a range of items to the collection.
- ///
- ///
- public void AddRange(IEnumerable items)
- {
- context.Collection.AddRange(items);
- }
-
- ///
- /// Adds list of items to the collection , optionally calls in memory sort. Used in Query.SelectItem
- ///
- /// collection
- /// true/false
- public void AddRange(IEnumerable items, bool inMemorySort)
- {
- context.Collection.AddRange(items);
-
- if (inMemorySort)
- {
- context.Collection.Sort();
- }
- }
-
- ///
- /// Adds a new item to the collection
- ///
- ///
- public void Add(T item)
- {
- context.Collection.Add(item);
- }
-
- #region Tobe overriden methods
- ///
- /// Invoked after SubmitChanges(), if there is new item in the colleciton.
- ///
- internal virtual bool AddItem(IBucket bucket)
- {
- // do nothing.
- return false;
- }
- ///
- /// Invoked after SubmitChanges(), if there are delted items in the collection.
- ///
- internal virtual bool RemoveItem(IBucket bucket)
- {
- // do nothing.
- return false;
- }
- ///
- /// Invoked after SubmitChanges(), if any of the object value is altered.
- ///
- internal virtual bool UpdateItem(IBucket bucket)
- {
- // do nothing.
- return false;
- }
-
- ///
- /// Called by the extender for select queries.
- ///
- /// bucekt interface.
- ///
- internal virtual void ExecuteQuery(IBucket bucket, IModifiableCollection items)
- {
- // does nothing.
- }
-
- #endregion
-
- ///
- /// When called, it invokes the appropiate Query method to finalize the collection changes.
- ///
- public void SubmitChanges()
- {
- var queryColleciton = (QueryCollection)context.Collection;
-
- var bucket = BucketImpl.NewInstance.Init();
-
- var deletedItems = new List>();
-
- foreach (var item in queryColleciton.Objects)
- {
- try
- {
- if (item.IsNewlyAdded)
- {
- bool added = PerformChange(bucket, item, this.AddItem);
-
- if (added)
- {
- // cache the item to track for update.
- (item as IVersionItem).Commit();
- }
- else
- {
- RaiseError(String.Format("{0} add failed", bucket.Name));
- }
-
- }
- else if (item.IsDeleted)
- {
- if (PerformChange(bucket, item, this.RemoveItem))
- {
- deletedItems.Add(item);
- }
- else
- {
- RaiseError(String.Format("{0} delete failed", bucket.Name));
- }
- }
- else if (item.IsAltered)
- {
- if (PerformChange(bucket, item, this.UpdateItem))
- {
- (item as IVersionItem).Commit();
- }
- else
- {
- (item as IVersionItem).Revert();
- RaiseError(String.Format("{0} update failed", bucket.Name));
- }
- }
- }
- catch (Exception ex)
- {
- throw new ProviderException(ex.Message, ex);
- }
- }
- // delete the removed items.
- foreach (var queryObject in deletedItems)
- {
- queryColleciton.Objects.Remove(queryObject);
- }
- }
-
- ///
- /// Visits the binary expression.
- ///
- /// Target expression
- /// Result expression
- public override Expression VisitBinary(BinaryExpression expression)
- {
-
- if (expression.NodeType == ExpressionType.AndAlso
- || expression.NodeType == ExpressionType.And
- || expression.NodeType == ExpressionType.Or
- || expression.NodeType == ExpressionType.OrElse)
- {
- var op = expression.NodeType == ExpressionType.AndAlso
- || expression.NodeType == ExpressionType.And ? LogicalOperator.And
- : LogicalOperator.Or;
-
- var temp = GetCurrentNode(parent, op);
-
- parent = temp;
-
- ++level;
-
- this.Visit(expression.Left);
-
- parent = temp;
-
- ++level;
-
- this.Visit(expression.Right);
-
- Buckets.Current.SyntaxStack.Pop();
-
- return expression;
- }
-
- bool singleOrExtensionCall = false;
-
- // for extension and single item call.
- if (Buckets.Current.SyntaxStack.Count == 0)
- {
- parent = GetCurrentNode(parent, LogicalOperator.And);
- singleOrExtensionCall = true;
- }
-
- Buckets.Current.Level = level;
- Buckets.Current.CurrentExpessionType = expression.NodeType;
- Buckets.Current.SyntaxStack.Peek().Level = level;
-
- Buckets.Current.SyntaxStack.Push(new BucketImpl.TreeNodeInfo
- {
- CompoundOperator = LogicalOperator.None,
- Id = Guid.NewGuid(),
- ParentId = Buckets.Current.SyntaxStack.Peek().Id,
- });
-
- Buckets.Current.CurrentTreeNode = parent;
-
- // push the state.
- this.ProcessBinaryResult(expression);
-
- if (singleOrExtensionCall)
- {
- Buckets.Current.SyntaxStack.Pop();
- }
-
- return expression;
- }
-
- public override Expression VisitConstant(ConstantExpression expression)
- {
- this.value = expression.Value;
- return expression;
- }
-
- public override Expression VisitUnary(UnaryExpression expression)
- {
- if (expression.NodeType == ExpressionType.Not)
- {
- this.Visit(Expression.MakeBinary(
- ExpressionType.NotEqual,
- expression.Operand,
- Expression.Constant(true)));
- }
- else
- {
- Visit(expression.Operand);
- }
-
- return expression;
- }
-
- public override Expression VisitMemberAccess(MemberExpression expression)
- {
- if (this.currentExpression is MethodCallExpression)
- {
- var mCall = this.currentExpression as MethodCallExpression;
-
- if (mCall.Method.Name == MethodNames.Group)
- {
- this.Visit(mCall);
-
- string key = Convert.ToString(this.value);
-
- if (!string.IsNullOrEmpty(key))
- {
- Buckets.Current.Group = new Bucket.GroupByContainer { Key = key };
- }
- }
- else if (mCall.Method.Name == MethodNames.Where)
- {
- // Handle where clause with just a boolean member type
- // Interpret Where(a => a.Member) as Where(a => a.Member == true)
- if (expression.NodeType == ExpressionType.MemberAccess && expression.Type == typeof(bool))
- {
- Visit(Expression.MakeBinary(ExpressionType.Equal, expression, Expression.Constant(true)));
- }
- }
- }
-
- return expression;
- }
-
- ///
- /// Visits the method call expression
- ///
- /// Target expression
- /// Result expression
- public override Expression VisitMethodCall(MethodCallExpression expression)
- {
- string methodName = expression.Method.Name;
-
- if (methodName != MethodNames.Where)
- {
- parent = null;
- level = 0;
- }
-
- if (methodName == MethodNames.Orderby || methodName == MethodNames.Orderbydesc || methodName == MethodNames.ThenBy)
- {
- Buckets.Current.IsAsc = methodName == MethodNames.Orderbydesc ? false : true;
-
- var orderbyVisitor = new OrderbyVisitor();
-
- orderbyVisitor.Visit(expression);
-
- Buckets.Current.OrderByItems.Add(new Bucket.OrderByInfo(orderbyVisitor.Member, Buckets.Current.IsAsc));
-
- return expression;
- }
- else
- {
- if (expression.Arguments.Count == 2)
- return this.Visit(expression.Arguments[1]);
- }
-
- throw new NotImplementedException(Messages.NotImplemetedExpressionWithMultipleArguments);
- }
-
- //private void FillOptionalBucketItems(Expression expression)
- //{
- // if (expression is MethodCallExpression)
- // {
- // var mCall = this.currentExpression as MethodCallExpression;
-
- // if (mCall.Method.Name == MethodNames.Take)
- // {
- // Buckets.Current.ItemsToTake = (int)value;
- // }
- // else if (mCall.Method.Name == MethodNames.Skip)
- // {
- // Buckets.Current.ItemsToSkip = (int)value;
- // }
- // }
- //}
-
- private TreeNode GetCurrentNode(TreeNode parentNode, LogicalOperator op)
- {
- Buckets.Current.SyntaxStack.Push(new BucketImpl.TreeNodeInfo
- {
- CompoundOperator = op,
- Id = Guid.NewGuid(),
- ParentId = Buckets.Current.SyntaxStack.Count > 0 ? Buckets.Current.SyntaxStack.Peek().Id : Guid.Empty,
- });
-
-
- Bucket bucket = Buckets.Current;
- TreeNode currentNode = null;
-
- var child = new TreeNode();
-
- if (parentNode == null && bucket.CurrentNode.Nodes.Count == 2)
- {
- parentNode = bucket.CurrentNode;
- // child becomes parent.
- child.Id = Guid.NewGuid();
- parentNode.ParentId = child.Id;
- child.RootImpl = op;
- child.Nodes.Add(new TreeNode.Node { Value = parentNode });
- bucket.CurrentNode = child;
- currentNode = child;
- }
- else if (parentNode != null)
- {
- child.Id = Buckets.Current.SyntaxStack.Peek().Id;
- child.RootImpl = op;
- child.ParentId = parentNode.Id;
- // make it a child.
- parentNode.Nodes.Add(new TreeNode.Node { Value = child });
- currentNode = child;
- }
- else
- {
- bucket.CurrentNode.Id = Buckets.Current.SyntaxStack.Peek().Id;
- bucket.CurrentNode.RootImpl = op;
- currentNode = bucket.CurrentNode;
- }
- return currentNode;
- }
-
-
- private Buckets Buckets
- {
- get
- {
- if (queryObjects == null)
- queryObjects = new Buckets();
- return queryObjects;
- }
- }
-
- internal void ProcessBinaryResult(Expression expression)
- {
- var binaryExpression = expression as BinaryExpression;
-
- if (binaryExpression != null)
- {
- if (binaryExpression.Left is MemberExpression)
- {
- ExtractDataFromExpression(Buckets.Current, binaryExpression.Left, binaryExpression.Right);
- }
- else
- {
- // For enumeration comparison, parse the additional Covert(ph.something) call
- if (binaryExpression.Left is UnaryExpression)
- {
- var uExp = (UnaryExpression)binaryExpression.Left;
-
- if (uExp.Operand is MethodCallExpression)
- {
- var methodCallExpression = (MethodCallExpression)uExp.Operand;
-
- FillBucketFromMethodCall(binaryExpression, methodCallExpression);
- }
- else
- {
- ExtractDataFromExpression(Buckets.Current, uExp.Operand, binaryExpression.Right);
- }
-
- }
- else if (binaryExpression.Left is MethodCallExpression)
- {
- var methodCallExpression = (MethodCallExpression)binaryExpression.Left;
- // if there are two arguments for name and value.
- if (methodCallExpression.Arguments.Count > 1)
- {
- ExtractDataFromExpression(Buckets.Current, methodCallExpression.Arguments[0],
- methodCallExpression.Arguments[1]);
- }
- else
- {
- FillBucketFromMethodCall(binaryExpression, methodCallExpression);
- }
- }
- }
- }
- else
- {
- var methodCallExpression = expression as MethodCallExpression;
-
- if (methodCallExpression != null)
- {
- FillBucketFromMethodCall(binaryExpression, methodCallExpression);
- }
- }
- }
-
- private void FillBucketFromMethodCall(BinaryExpression expression, MethodCallExpression methodCallExpression)
- {
- var bucketImpl = Buckets.Current;
- bucketImpl.IsDirty = true;
- bucketImpl.ClauseItemCount = bucketImpl.ClauseItemCount + 1;
- Buckets.Current.SyntaxStack.Pop();
-
- if (expression != null)
- {
- object value = Expression.Lambda(expression.Right).Compile().DynamicInvoke();
-
- var leafItem = new BucketItem
- {
- Name = methodCallExpression.Method.Name,
- Method = new BucketItem.ExtenderMethod
- {
- Name = methodCallExpression.Method.Name,
- Arguments = methodCallExpression.Arguments,
- Method = methodCallExpression.Method
- }
- };
-
- leafItem.Values.Add(new BucketItem.QueryCondition(value, bucketImpl.Relation));
- bucketImpl.CurrentTreeNode.Nodes.Add(new TreeNode.Node() { Value = leafItem });
- }
- else
- {
- var value = Expression.Lambda(methodCallExpression.Object).Compile().DynamicInvoke() as IEnumerable