Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.{json,yml}]
indent_size = 2

[*.cs]
csharp_new_line_before_open_brace = none
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ build_script:
- dotnet build net\DevExtreme.AspNet.Data.sln

test_script:
- npm run eclint-check
- npm test

- >-
Expand Down Expand Up @@ -45,4 +46,4 @@ on_success:

artifacts:
- path: net\DevExtreme.AspNet.Data\bin\Release\*.nupkg
- path: devextreme-aspnet-data-*.tgz
- path: devextreme-aspnet-data-*.tgz
2 changes: 1 addition & 1 deletion js-test/test-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ var TEST_DEPS = [
];

if(typeof module !== "undefined")
module.exports = TEST_DEPS;
module.exports = TEST_DEPS;
4 changes: 2 additions & 2 deletions js-test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<script>
TEST_DEPS.forEach(function(i) {
document.write("<script src='" + i + "'></scr" + "ipt>");
});
});
</script>

<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>

<div id="qunit"></div>

<script src="test.js"></script>
<script src="test.js"></script>
2 changes: 1 addition & 1 deletion js-test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
loadUrl: "/load",
loadParams: { custom: 123 },
onBeforeSend: function(op, ajax) {
assert.equal(op, "load");
assert.equal(op, "load");
assert.deepEqual(ajax.data, { custom: 123 });
done();
}
Expand Down
4 changes: 2 additions & 2 deletions js/dx.aspnet.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
return JSON.stringify(key);

return key;
}
}

function serializeDate(date) {

Expand All @@ -219,7 +219,7 @@
f = date.getMilliseconds();

if(h + m + s + f > 0)
builder.push(" ", zpad(h, 2), ":", zpad(m, 2), ":", zpad(s, 2), ".", zpad(f, 3));
builder.push(" ", zpad(h, 2), ":", zpad(m, 2), ":", zpad(s, 2), ".", zpad(f, 3));

return builder.join("");
}
Expand Down
10 changes: 5 additions & 5 deletions net/DevExtreme.AspNet.Data.Tests/AggregateCalculatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ SQL script to validate
#insert into t1 (a) values (null);

select concat(
" sum=", coalesce(sum(a), 'N'),
" min=", coalesce(min(a), 'N'),
" max=", coalesce(max(a), 'N'),
" avg=", coalesce(avg(a), 'N'),
" count=", coalesce(count(*), 'N')
" sum=", coalesce(sum(a), 'N'),
" min=", coalesce(min(a), 'N'),
" max=", coalesce(max(a), 'N'),
" avg=", coalesce(avg(a), 'N'),
" count=", coalesce(count(*), 'N')
) from t1;

*/
Expand Down
4 changes: 2 additions & 2 deletions net/DevExtreme.AspNet.Data.Tests/AnonTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AnonTypeTests {
[Fact]
public void Get() {
Assert.Same(
typeof(AnonType),
typeof(AnonType),
AnonType.Get(new Type[0])
);

Expand All @@ -29,7 +29,7 @@ public void Get() {
var x = Record.Exception(delegate {
AnonType.Get(Enumerable.Repeat(typeof(int), 100).ToArray());
});
Assert.Contains("Too many", x.Message);
Assert.Contains("Too many", x.Message);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void GuardNulls() {
Filter = new[] {
new[] { "Item1", ">", "0" },
new[] { "Item2", "contains", "z" },
new[] { "Item2.Length", ">", "1" },
new[] { "Item2.Length", ">", "1" },
new[] { "Item3.Year", ">", "0" }
},
Sort = new[] {
Expand All @@ -146,11 +146,11 @@ public void GuardNulls() {
Tuple.Create<int?, string, DateTime?>(null, "zz", new DateTime(2000, 1, 1)),
Tuple.Create<int?, string, DateTime?>(1, null, new DateTime(2000, 1, 1)),
Tuple.Create<int?, string, DateTime?>(1, "zz", null),


// kept
Tuple.Create<int?, string, DateTime?>(1, "zz", new DateTime(2000, 1, 2)),
Tuple.Create<int?, string, DateTime?>(1, "zz", new DateTime(2000, 1, 1))
Tuple.Create<int?, string, DateTime?>(1, "zz", new DateTime(2000, 1, 1))
};

var result = query(data.AsQueryable()).ToArray();
Expand Down
4 changes: 2 additions & 2 deletions net/DevExtreme.AspNet.Data.Tests/DataSourceLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void Load_TotalSummary() {
new SummaryInfo { Selector = "this", SummaryType = "min" },
new SummaryInfo { Selector = "this", SummaryType = "max" }
}
});
});

Assert.Equal(1, result.summary[0]);
Assert.Equal(3, result.summary[1]);
Expand All @@ -157,7 +157,7 @@ public void Load_GroupSummary() {
GroupSummary = new[] {
new SummaryInfo { Selector = "value", SummaryType = "sum" }
}
});
});

Assert.Equal(3M, result[0].summary[0]);
Assert.Equal(30M, result[1].summary[0]);
Expand Down
4 changes: 2 additions & 2 deletions net/DevExtreme.AspNet.Data.Tests/ExpressionCompilerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ExpressionCompilerTests {

class SampleCompiler : ExpressionCompiler {

public SampleCompiler(bool guardNulls)
public SampleCompiler(bool guardNulls)
: base(guardNulls) {
}

Expand Down Expand Up @@ -92,7 +92,7 @@ public void Accessor_ForceToString() {
Assert.Equal("t.Ref.ToString()", CompileAccessor(false, "Ref", true));

Assert.Equal(
"IIF((t == null), null, t.String)",
"IIF((t == null), null, t.String)",
CompileAccessor(true, "String", true)
);

Expand Down
8 changes: 4 additions & 4 deletions net/DevExtreme.AspNet.Data.Tests/RemoteGroupingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void GroupingAndSummary() {
TotalSummary = new[] {
new SummaryInfo { SummaryType = "count" },
new SummaryInfo { Selector = "B", SummaryType = "sum" },
new SummaryInfo { Selector = "B", SummaryType = "avg" },
new SummaryInfo { Selector = "B", SummaryType = "avg" },
}
};

Expand Down Expand Up @@ -105,9 +105,9 @@ public void GroupingAndSummary() {
Assert.Equal(new object[] { 3, 15M, 5M }, g2.summary);
Assert.Equal(new object[] { 2, 9M, 4.5M }, g21.summary);
Assert.Equal(new object[] { 1, 6M, 6M }, g22.summary);

Assert.Equal(2, g11.count);
Assert.Equal(1, g12.count);
Assert.Equal(1, g12.count);
Assert.Equal(2, g21.count);
Assert.Equal(1, g22.count);

Expand Down Expand Up @@ -225,7 +225,7 @@ public void RequireGroupCount() {
};

var result = (DataSourceLoadResult)DataSourceLoader.Load(data, loadOptions);

Assert.Equal(4, result.totalCount);

var groups = result.data.Cast<Group>().ToArray();
Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data.Tests/UtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void AddRequiredSort_Desc() {
}
};
var requiredSelectors = new[] { "R1", "R2" };

var ensuredSort = Utils.AddRequiredSort(initalSort, requiredSelectors).ToArray();
Assert.False(ensuredSort[1].Desc);
Assert.False(ensuredSort[2].Desc);
Expand Down
4 changes: 2 additions & 2 deletions net/DevExtreme.AspNet.Data/Aggregation/AggregateCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ void ProcessItem(object item) {
void ProcessGroup(Group group) {
if(_groupAggregatorsStack != null)
_groupAggregatorsStack.Push(_groupSummaryTypes.Select(CreateAggregator).ToArray());

foreach(var i in group.items)
ProcessItem(i);

if(_groupAggregatorsStack != null)
group.summary = Finish(_groupAggregatorsStack.Pop());
group.summary = Finish(_groupAggregatorsStack.Pop());
}

void Step(object obj, Aggregator<T>[] aggregators, string[] selectors) {
Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/Aggregation/AvgAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AvgAggregator<T> : Aggregator<T> {
Aggregator<T> _counter;
SumAggregator<T> _summator;

public AvgAggregator(IAccessor<T> accessor, Aggregator<T> counter)
public AvgAggregator(IAccessor<T> accessor, Aggregator<T> counter)
: base(accessor) {
_counter = counter;
_summator = new SumAggregator<T>(accessor);
Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/Aggregation/CountAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CountAggregator<T> : Aggregator<T> {
int _count;
bool _skipNulls;

public CountAggregator(IAccessor<T> accessor, bool skipNulls)
public CountAggregator(IAccessor<T> accessor, bool skipNulls)
: base(accessor) {
_skipNulls = skipNulls;
}
Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/Aggregation/MaxAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace DevExtreme.AspNet.Data.Aggregation {
class MaxAggregator<T> : Aggregator<T> {
object _max = null;

public MaxAggregator(IAccessor<T> accessor)
public MaxAggregator(IAccessor<T> accessor)
: base(accessor) {
}

Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/Aggregation/MinAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace DevExtreme.AspNet.Data.Aggregation {
class MinAggregator<T> : Aggregator<T> {
object _min = null;

public MinAggregator(IAccessor<T> accessor)
public MinAggregator(IAccessor<T> accessor)
: base(accessor) {
}

Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/Aggregation/SumAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace DevExtreme.AspNet.Data.Aggregation {
class SumAggregator<T> : Aggregator<T> {
decimal? _sum;

public SumAggregator(IAccessor<T> accessor)
public SumAggregator(IAccessor<T> accessor)
: base(accessor) {
}

Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

#if !DEBUG
[assembly: AssemblyKeyFile("release.snk")]
#endif
#endif
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/DataSourceLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static IQueryable<R> ExecQuery<S, R>(Func<IQueryable<S>, IQueryable<R>> query, I
result = new QueryableOnce<R>(result);

if(options.ExpressionWatcher != null)
options.ExpressionWatcher(result.Expression);
options.ExpressionWatcher(result.Expression);
#endif

return result;
Expand Down
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/DefaultAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace DevExtreme.AspNet.Data {
class DefaultAccessor<T> : ExpressionCompiler, IAccessor<T> {
IDictionary<string, Func<T, object>> _accessors;

public DefaultAccessor()
public DefaultAccessor()
: base(true) {
}

Expand Down
4 changes: 2 additions & 2 deletions net/DevExtreme.AspNet.Data/ExpressionCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ protected internal Expression CompileAccessorExpression(Expression target, strin
}

if(forceToString && currentTarget.Type != typeof(String))
progression.Add(Expression.Call(currentTarget, typeof(Object).GetMethod(nameof(Object.ToString))));
progression.Add(Expression.Call(currentTarget, typeof(Object).GetMethod(nameof(Object.ToString))));

return CompileNullGuard(progression);
}

Expand Down
4 changes: 2 additions & 2 deletions net/DevExtreme.AspNet.Data/FilterExpressionCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace DevExtreme.AspNet.Data {

class FilterExpressionCompiler<T> : ExpressionCompiler {

public FilterExpressionCompiler(bool guardNulls)
public FilterExpressionCompiler(bool guardNulls)
: base(guardNulls) {
}

Expand All @@ -28,7 +28,7 @@ Expression CompileCore(ParameterExpression dataItemExpr, IList criteriaJson) {
try {
if(IsUnary(criteriaJson)) {
return CompileUnary(dataItemExpr, criteriaJson);
}
}

return CompileBinary(dataItemExpr, criteriaJson);
} catch {
Expand Down
4 changes: 2 additions & 2 deletions net/DevExtreme.AspNet.Data/NET40.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace DevExtreme.AspNet.Data {
// https://github.com/dotnet/coreclr/blob/release/1.0.0-rc1/src/mscorlib/src/System/Reflection/TypeInfo.cs

static class TypeExtensions {
internal const BindingFlags
internal const BindingFlags
EVERYTHING = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;

public static TypeInfo GetTypeInfo(this Type type) {
Expand Down Expand Up @@ -53,4 +53,4 @@ public Type GetGenericTypeDefinition() {
}

}
#endif
#endif
2 changes: 1 addition & 1 deletion net/DevExtreme.AspNet.Data/QueryableOnce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ IEnumerator<T> GetEnumerator() {
}

}
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace DevExtreme.AspNet.Data.RemoteGrouping {
class RemoteCountAggregator<T> : Aggregator<T> {
int _count = 0;

public RemoteCountAggregator(IAccessor<T> accessor)
public RemoteCountAggregator(IAccessor<T> accessor)
: base(accessor) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RemoteGroupExpressionCompiler<T> : ExpressionCompiler {
Type _remoteGroupType;
RemoteGroupTypeMarkup _remoteGroupTypeMarkup;

public RemoteGroupExpressionCompiler(GroupingInfo[] grouping, SummaryInfo[] totalSummary, SummaryInfo[] groupSummary)
public RemoteGroupExpressionCompiler(GroupingInfo[] grouping, SummaryInfo[] totalSummary, SummaryInfo[] groupSummary)
: base(false) {

_groupByParam = CreateItemParam(typeof(T));
Expand Down Expand Up @@ -140,7 +140,7 @@ Expression MakeAggregatingProjection(Expression target, ParameterExpression para
}

AddAggregateBindings(projectionBindings, param, _totalSummaryExprList, _totalSummaryParams, _totalSummaryTypes, _remoteGroupTypeMarkup.TotalSummaryStartIndex);
AddAggregateBindings(projectionBindings, param, _groupSummaryExprList, _groupSummaryParams, _groupSummaryTypes, _remoteGroupTypeMarkup.GroupSummaryStartIndex);
AddAggregateBindings(projectionBindings, param, _groupSummaryExprList, _groupSummaryParams, _groupSummaryTypes, _remoteGroupTypeMarkup.GroupSummaryStartIndex);

var projectionLambda = Expression.Lambda(
Expression.MemberInit(
Expand Down Expand Up @@ -174,7 +174,7 @@ void AddAggregateBindings(ICollection<MemberAssignment> bindingList, Expression
);
}
}

static string GetPreAggregateMethodName(string summaryType) {
switch(summaryType) {
case "min":
Expand All @@ -195,9 +195,9 @@ Expression CompileGroupInterval(Expression selector, string intervalString) {
ExpressionType.Subtract,
selector,
Expression.MakeBinary(
ExpressionType.Modulo,
selector,
Expression.Convert(
ExpressionType.Modulo,
selector,
Expression.Convert(
Expression.Constant(Int32.Parse(intervalString)),
selector.Type
)
Expand Down
Loading