Skip to content

Commit

Permalink
updated to higher dotnet. Resolved warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Von Seggern committed Dec 7, 2023
1 parent 1ef532d commit 193baba
Show file tree
Hide file tree
Showing 83 changed files with 529 additions and 866 deletions.
4 changes: 2 additions & 2 deletions Graph/Graph.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Immutability" Version="0.0.1" />
<PackageReference Include="QuickCache" Version="1.0.0" />
<PackageReference Include="Immutability" Version="0.0.3" />
<PackageReference Include="QuickCache" Version="1.0.1" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions NoData.Tests/NoData.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand All @@ -25,4 +25,4 @@
<ProjectReference Include="..\SampleWebApi\SampleWebApi.csproj"/>
<ProjectReference Include="..\SampleEFCoreApi\SampleEFCoreApi.csproj"/>
</ItemGroup>
</Project>
</Project>
1 change: 1 addition & 0 deletions NoData/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using System;
6 changes: 1 addition & 5 deletions NoData/GraphImplementations/QueryParser/Edge.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using Immutability;
using Graph.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;

namespace NoData.GraphImplementations.QueryParser
{
[Immutable]
public class EdgeInfo
{
public string PropertyName { get; }
public string PropertyName { get; } = "";
}

[Immutable]
Expand Down
14 changes: 5 additions & 9 deletions NoData/GraphImplementations/QueryParser/TextInfo.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
using Immutability;
using Graph.Interfaces;
using NoData.Internal.TreeParser.Tokenizer;
using System;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;

namespace NoData.GraphImplementations.QueryParser
{
[Immutable]
public class TextInfo
{
public string Text { get; }
public string? Text { get; }
public string Representation { get; }

// Type and Parsed should be deleted
public Type Type { get; }
public object Parsed { get; }
public Type? Type { get; } = null;
public object? Parsed { get; } = null;

public TextInfo(string text, string representation)
public TextInfo(string? text, string representation)
{
Text = text;
Representation = representation;
}
public TextInfo(string text, string representation, Type type) : this(text, representation)
public TextInfo(string? text, string representation, Type type) : this(text, representation)
{
Type = type;
}
Expand Down
4 changes: 2 additions & 2 deletions NoData/GraphImplementations/QueryParser/TextRepresentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public string NextRep()
return $"{EscapeCharacter}{littleChar}";
return $"{EscapeCharacter}{possibleChars[tenColumn - 1]}{littleChar}";
}
public string NextRep(string regex) => regex is null ? null : NextRep();
public string NextRep(string regex) => regex is null ? throw new NullReferenceException(nameof(regex)) : NextRep();
// public string NextRep(string regex) => System.Text.RegularExpressions.Regex.Escape(regex); // more human readable, but slower, way of getting text representation.
}

Expand Down Expand Up @@ -83,4 +83,4 @@ public static class TextRepresentation
public static string StrTrim { get; } = ConstRep.NextRep("<str_trim>");
public static string StrReplace { get; } = ConstRep.NextRep("<str_replace>");
}
}
}
4 changes: 0 additions & 4 deletions NoData/GraphImplementations/QueryParser/Tree.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using Immutability;
using Graph;
using NoData.QueryParser.ParsingTools.Groupers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace NoData.GraphImplementations.QueryParser
{
Expand Down
5 changes: 0 additions & 5 deletions NoData/GraphImplementations/QueryParser/Vertex.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using Immutability;
using NoData.Internal.TreeParser.Tokenizer;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;

namespace NoData.GraphImplementations.QueryParser
{
Expand Down
4 changes: 1 addition & 3 deletions NoData/GraphImplementations/Queryable/QueryClass.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using Immutability;
using Property = NoData.GraphImplementations.Schema.Property;

Expand All @@ -19,4 +17,4 @@ public QueryClass(int typeId, IEnumerable<Property> properties)
}

}
}
}
4 changes: 2 additions & 2 deletions NoData/GraphImplementations/Queryable/QueryEdge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace NoData.GraphImplementations.Queryable
[Immutable]
public class QueryEdge : Graph.Edge<Property, QueryVertex, QueryClass>
{
public QueryEdge(QueryVertex from, QueryVertex to, Property value = null) : base(from, to, value)
public QueryEdge(QueryVertex from, QueryVertex to, Property? value = null) : base(from, to, value!)
{
}
}
}
}
3 changes: 1 addition & 2 deletions NoData/GraphImplementations/Queryable/QueryGraph.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections.Generic;
using Immutability;
using Property = NoData.GraphImplementations.Schema.Property;

Expand All @@ -11,4 +10,4 @@ public QueryGraph(IEnumerable<QueryVertex> vertices, IEnumerable<QueryEdge> edge
{
}
}
}
}
6 changes: 1 addition & 5 deletions NoData/GraphImplementations/Queryable/QueryPath.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System.Collections.Generic;
using Immutability;
using Graph;
using Graph.Interfaces;
using NoData.GraphImplementations.Schema;
using Property = NoData.GraphImplementations.Schema.Property;

namespace NoData.GraphImplementations.Queryable
Expand All @@ -14,4 +10,4 @@ public QueryPath(IEnumerable<QueryEdge> edges) : base(edges)
{
}
}
}
}
11 changes: 3 additions & 8 deletions NoData/GraphImplementations/Queryable/QueryTree.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using QuickCache;
using Immutability;
using Graph;
using Graph.Interfaces;
using Newtonsoft.Json;
using NoData.GraphImplementations.Schema;
using Property = NoData.GraphImplementations.Schema.Property;

namespace NoData.GraphImplementations.Queryable
{
[Immutable]
public class QueryTree : Graph.Tree<QueryTree, QueryVertex, QueryEdge, QueryClass, Property>
{
public QueryTree(QueryVertex root, IEnumerable<ITuple<QueryEdge, QueryTree>> children = null) : base(root, children)
public QueryTree(QueryVertex root, IEnumerable<ITuple<QueryEdge, QueryTree>>? children = null) : base(root, children)
{
}

Expand All @@ -26,7 +21,7 @@ public QueryTree(QueryVertex root, IEnumerable<ITuple<QueryEdge, QueryTree>> chi
public string AsJson<T>(T item) => this.ObjectAsJson(item);

private static ICacheForever<int, FastMember.TypeAccessor> AccessorCache = new DictionaryCache<int, FastMember.TypeAccessor>();
private string ObjectAsJson(object item)
private string ObjectAsJson(object? item)
{
if (item is null)
return "null";
Expand Down Expand Up @@ -72,4 +67,4 @@ private string ObjectAsJson(object item)
}
}
}
}
}
3 changes: 1 addition & 2 deletions NoData/GraphImplementations/Queryable/QueryVertex.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using Immutability;

namespace NoData.GraphImplementations.Queryable
Expand All @@ -10,4 +9,4 @@ public QueryVertex(QueryClass value) : base(value)
{
}
}
}
}
9 changes: 3 additions & 6 deletions NoData/GraphImplementations/Schema/ClassInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Graph.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using NoData.Utility;
using NoData.Utility;
using Immutability;

namespace NoData.GraphImplementations.Schema
Expand Down Expand Up @@ -95,6 +90,8 @@ public override bool Equals(object obj)
if (obj is ClassInfo)
{
var other = obj as ClassInfo;
if(other is null)
return false;
return TypeId == other.TypeId;
}
return false;
Expand Down
5 changes: 1 addition & 4 deletions NoData/GraphImplementations/Schema/Edge.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Immutability;
using Immutability;

namespace NoData.GraphImplementations.Schema
{
Expand Down
11 changes: 4 additions & 7 deletions NoData/GraphImplementations/Schema/GraphSchema.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Immutability;
using Immutability;
using Graph;
using NoData.Utility;

Expand Down Expand Up @@ -40,7 +37,7 @@ ClassInfoUtility GetClassInfoFromType(Type t)
bool VerticesContainType(Type type) => vertices.Any(v => v.Vertex.Value.TypeId == type.GetHashCode());
StatefulVertex<ClassInfo> GetOrAddVertex(Type type)
{
StatefulVertex<ClassInfo> vertex = null;
StatefulVertex<ClassInfo>? vertex = null;
if (VerticesContainType(type))
vertex = vertices.First(v => v.Vertex.Value.TypeId == type.GetHashCode());
else
Expand All @@ -65,7 +62,7 @@ StatefulVertex<ClassInfo> GetOrAddVertex(Type type)
void EstablishConnection(Type connectionToType, Property property)
{
var toVertex = GetOrAddVertex(connectionToType);
var edge = new Edge(vertex.Vertex as Vertex, toVertex.Vertex as Vertex, property);
var edge = new Edge((vertex.Vertex as Vertex)!, (toVertex.Vertex as Vertex)!, property);
if (!edges.Contains(edge))
edges.Add(edge);
}
Expand All @@ -86,7 +83,7 @@ void EstablishConnection(Type connectionToType, Property property)
vertex.Color = StatefulVertexStateType.Discovered;
}

return new GraphSchema(vertices.Select(v => v.Vertex as Vertex), edges);
return new GraphSchema(vertices?.Select(v => (v.Vertex as Vertex)!) ?? new List<Vertex>().AsEnumerable(), edges);
}
}
}
3 changes: 1 addition & 2 deletions NoData/GraphImplementations/Schema/Path.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Immutability;
using Immutability;

namespace NoData.GraphImplementations.Schema
{
Expand Down
3 changes: 1 addition & 2 deletions NoData/GraphImplementations/Schema/PathToProperty.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections.Generic;
using Immutability;

namespace NoData.GraphImplementations.Schema
Expand All @@ -12,4 +11,4 @@ public PathToProperty(IEnumerable<Edge> edges, Property property) : base(edges)
Property = property;
}
}
}
}
5 changes: 1 addition & 4 deletions NoData/GraphImplementations/Schema/Property.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Immutability;

Expand Down Expand Up @@ -38,4 +35,4 @@ public Property(PropertyInfo prop)
}
}
}
}
}
6 changes: 1 addition & 5 deletions NoData/GraphImplementations/Schema/SubGraphSchema.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Immutability;
using NoData.Utility;
using Immutability;

namespace NoData.GraphImplementations.Schema
{
Expand Down
6 changes: 0 additions & 6 deletions NoData/GraphImplementations/Schema/Tree.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using Immutability;
using Graph;
using Graph.Interfaces;
using NoData.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace NoData.GraphImplementations.Schema
{
Expand Down
9 changes: 1 addition & 8 deletions NoData/GraphImplementations/Schema/Vertex.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Immutability;
using Graph.Interfaces;
using NoData.Utility;
using Immutability;

namespace NoData.GraphImplementations.Schema
{
Expand Down
3 changes: 1 addition & 2 deletions NoData/INoData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Linq;
using AutoMapper;
using Immutability;

Expand All @@ -11,4 +10,4 @@ public interface INoData<TDto>

INoDataQuery<TDto> Projection<TEntity>(IQueryable<TEntity> sourceQueryable, IConfigurationProvider mapperConfiguration);
}
}
}
6 changes: 1 addition & 5 deletions NoData/INoDataQuery.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Immutability;
using Microsoft.AspNetCore.Http;

Expand All @@ -21,4 +17,4 @@ public interface INoDataQuery<out TDto>
Task StreamResponse(Stream responseBody);
Stream Stream();
}
}
}
Loading

0 comments on commit 193baba

Please sign in to comment.