Skip to content
This repository was archived by the owner on Feb 15, 2021. It is now read-only.

Commit 865ce93

Browse files
israelramosmgeoperez
authored andcommitted
Vs2017 (#15)
* Migrated to VS 2017 and netstandard2.0 * Corrected observations * Update appveyor.yml * Update appveyor.yml * Fixed SA1616, Added Solution Items, changed travis to dotnet * Changed returns documentation * Update .travis.yml * Added StyleCop.Analyzers.ruleset * Fixed more SA1616 * Corrected observations
1 parent 355ad32 commit 865ce93

18 files changed

+156
-499
lines changed

.travis.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ language: csharp
22
solution: Unosquare.Labs.LiteLib.sln
33
notifications:
44
slack: unolabs:cbusXPH6pBwZ35rVDzi4k4ve
5-
os:
6-
- linux
7-
- osx
5+
dotnet: 2.0.0
86
install:
9-
- nuget restore Unosquare.Labs.LiteLib.sln
10-
- nuget install NUnit.Runners -Version 3.4.1 -OutputDirectory testrunner
7+
- dotnet restore
118
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then sudo apt-get install sqlite; fi
129
script:
13-
- xbuild /p:Configuration=Mono Unosquare.Labs.LiteLib.sln
14-
- mono ./testrunner/NUnit.ConsoleRunner.3.4.1/tools/nunit3-console.exe --process=Single ./test/Unosquare.Labs.LiteLib.Tests/bin/Mono/Unosquare.Labs.LiteLib.Tests.dll
10+
- dotnet test ./test/Unosquare.Labs.LiteLib.Tests/Unosquare.Labs.LiteLib.Tests.csproj -f netcoreapp2.0

Unosquare.Labs.LiteLib.Core.sln

Lines changed: 0 additions & 45 deletions
This file was deleted.

Unosquare.Labs.LiteLib.sln

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26730.12
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unosquare.Labs.LiteLib", "src\Unosquare.Labs.LiteLib\Unosquare.Labs.LiteLib.csproj", "{61110638-2D09-4B02-A543-AE32D182C0CE}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Unosquare.Labs.LiteLib", "src\Unosquare.Labs.LiteLib\Unosquare.Labs.LiteLib.csproj", "{61110638-2D09-4B02-A543-AE32D182C0CE}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unosquare.Labs.LiteLib.Tests", "test\Unosquare.Labs.LiteLib.Tests\Unosquare.Labs.LiteLib.Tests.csproj", "{35CA62F7-7CC8-4086-BE8B-1195D48F3232}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Unosquare.Labs.LiteLib.Tests", "test\Unosquare.Labs.LiteLib.Tests\Unosquare.Labs.LiteLib.Tests.csproj", "{35CA62F7-7CC8-4086-BE8B-1195D48F3232}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{615FCCD1-FBB0-4BBC-9BD9-F27D9591429C}"
11+
ProjectSection(SolutionItems) = preProject
12+
.travis.yml = .travis.yml
13+
appveyor.yml = appveyor.yml
14+
LICENSE = LICENSE
15+
README.md = README.md
16+
StyleCop.Analyzers.ruleset = StyleCop.Analyzers.ruleset
17+
EndProjectSection
918
EndProject
1019
Global
1120
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -16,18 +25,21 @@ Global
1625
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1726
{61110638-2D09-4B02-A543-AE32D182C0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1827
{61110638-2D09-4B02-A543-AE32D182C0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
19-
{61110638-2D09-4B02-A543-AE32D182C0CE}.Mono|Any CPU.ActiveCfg = Mono|Any CPU
20-
{61110638-2D09-4B02-A543-AE32D182C0CE}.Mono|Any CPU.Build.0 = Mono|Any CPU
28+
{61110638-2D09-4B02-A543-AE32D182C0CE}.Mono|Any CPU.ActiveCfg = Release|Any CPU
29+
{61110638-2D09-4B02-A543-AE32D182C0CE}.Mono|Any CPU.Build.0 = Release|Any CPU
2130
{61110638-2D09-4B02-A543-AE32D182C0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
2231
{61110638-2D09-4B02-A543-AE32D182C0CE}.Release|Any CPU.Build.0 = Release|Any CPU
2332
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2433
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Debug|Any CPU.Build.0 = Debug|Any CPU
25-
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Mono|Any CPU.ActiveCfg = Mono|Any CPU
26-
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Mono|Any CPU.Build.0 = Mono|Any CPU
34+
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Mono|Any CPU.ActiveCfg = Release|Any CPU
35+
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Mono|Any CPU.Build.0 = Release|Any CPU
2736
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Release|Any CPU.ActiveCfg = Release|Any CPU
2837
{35CA62F7-7CC8-4086-BE8B-1195D48F3232}.Release|Any CPU.Build.0 = Release|Any CPU
2938
EndGlobalSection
3039
GlobalSection(SolutionProperties) = preSolution
3140
HideSolutionNode = FALSE
3241
EndGlobalSection
42+
GlobalSection(ExtensibilityGlobals) = postSolution
43+
SolutionGuid = {B8F223FC-160A-4FDE-9262-1324249193C5}
44+
EndGlobalSection
3345
EndGlobal

appveyor.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
version: '1.0.{build}'
2+
image: Visual Studio 2017
3+
build:
4+
project: Unosquare.Labs.LiteLib.sln
25
configuration:
36
- Release
47
platform: Any CPU
@@ -29,11 +32,6 @@ before_build:
2932
- mkdir tools
3033
- nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
3134
- nuget install coveralls.net -Version 0.7.0 -OutputDirectory tools
32-
- nuget install sqlite -Version 3.13.0 -OutputDirectory tools
33-
build_script:
34-
- dotnet build "src\Unosquare.Labs.LiteLib" -c %CONFIGURATION%
35-
- dotnet build "test\Unosquare.Labs.LiteLib.Tests" -c %CONFIGURATION%
36-
- cp tools\SQLite.3.13.0\runtimes\win7-x64\native\sqlite3.dll test\Unosquare.Labs.LiteLib.Tests\bin\Release\net452\win8-x64\sqlite3.dll
3735
test_script:
3836
- tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"%ProgramFiles%\dotnet\dotnet.exe" -targetargs:"test "test\Unosquare.Labs.LiteLib.Tests" -c %CONFIGURATION%" -output:coverage.xml -filter:"+[*]* -[Unosquare.Swan*]* -[Unosquare.Labs.LiteLib.Tests*]*" -register:userdotnet
3937
- tools\coveralls.net.0.7.0\tools\csmacnz.Coveralls.exe --opencover -i coverage.xml --serviceName appveyor --jobId %APPVEYOR_BUILD_NUMBER%

global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Unosquare.Labs.LiteLib/Extensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static class Extensions
3232
/// Gets the type mapping.
3333
/// </summary>
3434
/// <param name="propertyType">Type of the property.</param>
35-
/// <returns></returns>
35+
/// <returns>A property type of the mapping</returns>
3636
public static string GetTypeMapping(this Type propertyType)
3737
{
3838
return TypeMappings.ContainsKey(propertyType) ? TypeMappings[propertyType] : TextAffinity;
@@ -42,7 +42,7 @@ public static string GetTypeMapping(this Type propertyType)
4242
/// Transform a DateTime to a SQLite UTC date.
4343
/// </summary>
4444
/// <param name="utcDate">The UTC date.</param>
45-
/// <returns></returns>
45+
/// <returns>UTC DateTime</returns>
4646
public static DateTime ToSQLiteUtcDate(this DateTime utcDate)
4747
{
4848
var startupDifference = (int)DateTime.UtcNow.Subtract(DateTime.Now).TotalHours;

src/Unosquare.Labs.LiteLib/ILiteDbSet.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ public interface ILiteDbSet<T> : ILiteDbSet
6363
/// Inserts the specified entity.
6464
/// </summary>
6565
/// <param name="entity">The entity.</param>
66-
/// <returns></returns>
66+
/// <returns>The number of rows inserted</returns>
6767
int Insert(T entity);
6868

6969
/// <summary>
7070
/// Deletes the specified entity. RowId must be set.
7171
/// </summary>
7272
/// <param name="entity">The entity.</param>
73-
/// <returns></returns>
73+
/// <returns>The number of rows deleted</returns>
7474
int Delete(T entity);
7575

7676
/// <summary>
7777
/// Updates the specified entity in a non optimistic concurrency manner.
7878
/// RowId must be set.
7979
/// </summary>
8080
/// <param name="entity">The entity.</param>
81-
/// <returns></returns>
81+
/// <returns>The number of rows updated</returns>
8282
int Update(T entity);
8383

8484
/// <summary>
@@ -87,73 +87,74 @@ public interface ILiteDbSet<T> : ILiteDbSet
8787
/// </summary>
8888
/// <param name="whereText">The where text.</param>
8989
/// <param name="whereParams">The where parameters.</param>
90-
/// <returns></returns>
90+
/// <returns>A Enumerable with generic type</returns>
9191
IEnumerable<T> Select(string whereText, object whereParams);
9292

9393
/// <summary>
9494
/// Selects all entities from the database.
9595
/// </summary>
96-
/// <returns></returns>
96+
/// <returns>A Enumerable with generic type</returns>
9797
IEnumerable<T> SelectAll();
9898

9999
/// <summary>
100100
/// Selects a single entity from the databse given its row id.
101101
/// </summary>
102102
/// <param name="rowId">The row identifier.</param>
103-
/// <returns></returns>
103+
/// <returns>A generic type</returns>
104104
T Single(long rowId);
105105

106106
/// <summary>
107107
/// Counts the total number of rows in the table
108108
/// </summary>
109+
/// <returns>The total number of rows</returns>
109110
int Count();
110111

111112
/// <summary>
112113
/// Provides and asynchronous counterpart to the Insert method
113114
/// </summary>
114115
/// <param name="entity">The entity.</param>
115-
/// <returns></returns>
116+
/// <returns>A Task with the number of rows inserted</returns>
116117
Task<int> InsertAsync(T entity);
117118

118119
/// <summary>
119120
/// Provides and asynchronous counterpart to the Delete method
120121
/// </summary>
121122
/// <param name="entity">The entity.</param>
122-
/// <returns></returns>
123+
/// <returns>A Task with the number of rows deleted</returns>
123124
Task<int> DeleteAsync(T entity);
124125

125126
/// <summary>
126127
/// Provides and asynchronous counterpart to the Update method
127128
/// </summary>
128129
/// <param name="entity">The entity.</param>
129-
/// <returns></returns>
130+
/// <returns>A Task with the number of rows updated</returns>
130131
Task<int> UpdateAsync(T entity);
131132

132133
/// <summary>
133134
/// Provides and asynchronous counterpart to the Select method
134135
/// </summary>
135136
/// <param name="whereText">The where text.</param>
136137
/// <param name="whereParams">The where parameters.</param>
137-
/// <returns></returns>
138+
/// <returns>A Task of type Enumerable with a generic type</returns>
138139
Task<IEnumerable<T>> SelectAsync(string whereText, object whereParams);
139140

140141
/// <summary>
141142
/// Selects all asynchronous.
142143
/// </summary>
143-
/// <returns></returns>
144+
/// <returns>A Task of type Enumerable with a generic type</returns>
144145
Task<IEnumerable<T>> SelectAllAsync();
145-
146+
146147
/// <summary>
147148
/// Provides and asynchronous counterpart to the Single method
148149
/// </summary>
149150
/// <param name="rowId">The row identifier.</param>
150-
/// <returns></returns>
151+
/// <returns>A Task with a generyc type</returns>
151152
Task<T> SingleAsync(long rowId);
152153

153154
/// <summary>
154155
/// Provides and asynchronous counterpart to the Count method
155156
/// </summary>
156-
/// <returns></returns>
157+
/// <returns>A Task with the total number of rows</returns>
157158
Task<int> CountAsync();
158159
}
159160
}

src/Unosquare.Labs.LiteLib/LiteDbContext.cs

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private void LoadEntitySets()
115115
p.PropertyType.GetTypeInfo().IsGenericType &&
116116
p.PropertyType.GetGenericTypeDefinition() == GenericLiteDbSetType);
117117
});
118-
118+
119119
foreach (var entitySetProp in contextDbSetProperties)
120120
{
121121
var entitySetType = entitySetProp.PropertyType.GetGenericArguments()[0];
@@ -141,7 +141,9 @@ private void LoadEntitySets()
141141
/// <summary>
142142
/// Vacuums the database asynchronously.
143143
/// </summary>
144-
/// <returns></returns>
144+
/// <returns>
145+
/// A Task that represent the Execution of the Vacuum command
146+
/// </returns>
145147
public async Task VaccuumDatabaseAsync()
146148
{
147149
"DB VACUUM command executing.".Debug(nameof(LiteDbContext));
@@ -150,11 +152,13 @@ public async Task VaccuumDatabaseAsync()
150152
}
151153

152154
/// <summary>
153-
/// Returns a non-generic ILiteDbSet instance for access to entities of the given type in the context and the underlying store.
155+
/// Sets the specified entity type.
154156
/// </summary>
155157
/// <param name="entityType">Type of the entity.</param>
156-
/// <returns></returns>
157-
/// <exception cref="ArgumentOutOfRangeException"></exception>
158+
/// <returns>
159+
/// A non-generic liteDbSet instance for access to entities of the given type in the context and the underlying store.
160+
/// </returns>
161+
/// <exception cref="ArgumentOutOfRangeException">Throws an ArgumentOutOfRangeException</exception>
158162
public ILiteDbSet Set(Type entityType)
159163
{
160164
var set = _entitySets.Values.FirstOrDefault(x => x.GetType().GetTypeInfo().GetGenericArguments().Any(z => z == entityType));
@@ -166,10 +170,12 @@ public ILiteDbSet Set(Type entityType)
166170
}
167171

168172
/// <summary>
169-
/// Returns a ILiteDbSet instance for access to entities of the given type in the context and the underlying store.
173+
/// Sets this instance.
170174
/// </summary>
171175
/// <typeparam name="TEntity">Entity type</typeparam>
172-
/// <returns></returns>
176+
/// <returns>
177+
/// A liteDbSet instance for access to entities of the given type in the context and the underlying store.
178+
/// </returns>
173179
public ILiteDbSet Set<TEntity>()
174180
{
175181
return Set(typeof(TEntity));
@@ -178,7 +184,7 @@ public ILiteDbSet Set<TEntity>()
178184
/// <summary>
179185
/// Gets the set names.
180186
/// </summary>
181-
/// <returns></returns>
187+
/// <returns>An array of strings of the entities</returns>
182188
public string[] GetSetNames() => _entitySets.Keys.ToArray();
183189

184190
/// <summary>
@@ -188,20 +194,20 @@ public ILiteDbSet Set<TEntity>()
188194
/// <param name="set">The set.</param>
189195
/// <param name="whereText">The where text.</param>
190196
/// <param name="whereParams">The where parameters.</param>
191-
/// <returns></returns>
197+
/// <returns>An enumerable of type of the Entity</returns>
192198
public IEnumerable<TEntity> Select<TEntity>(ILiteDbSet set, string whereText, object whereParams = null)
193199
{
194200
return Query<TEntity>($"{set.SelectDefinition} WHERE {whereText}", whereParams);
195201
}
196-
202+
197203
/// <summary>
198204
/// Selects the asynchronous.
199205
/// </summary>
200206
/// <typeparam name="TEntity">The type of the entity.</typeparam>
201207
/// <param name="set">The set.</param>
202208
/// <param name="whereText">The where text.</param>
203209
/// <param name="whereParams">The where parameters.</param>
204-
/// <returns></returns>
210+
/// <returns>A Task with a enumerable of type of the entity</returns>
205211
public async Task<IEnumerable<TEntity>> SelectAsync<TEntity>(ILiteDbSet set, string whereText, object whereParams = null)
206212
{
207213
return await QueryAsync<TEntity>($"{set.SelectDefinition} WHERE {whereText}", whereParams);
@@ -213,7 +219,9 @@ public async Task<IEnumerable<TEntity>> SelectAsync<TEntity>(ILiteDbSet set, str
213219
/// <typeparam name="TEntity">The type of the entity.</typeparam>
214220
/// <param name="commandText">The command text.</param>
215221
/// <param name="whereParams">The where parameters.</param>
216-
/// <returns>An enumerable of the type</returns>
222+
/// <returns>
223+
/// An enumerable of the type of the entity
224+
/// </returns>
217225
public IEnumerable<TEntity> Query<TEntity>(string commandText, object whereParams = null)
218226
{
219227
LogSqlCommand(commandText, whereParams);
@@ -226,7 +234,9 @@ public IEnumerable<TEntity> Query<TEntity>(string commandText, object whereParam
226234
/// <typeparam name="TEntity">The type of the entity.</typeparam>
227235
/// <param name="commandText">The command text.</param>
228236
/// <param name="whereParams">The where parameters.</param>
229-
/// <returns>A Task with an enumerable of the type</returns>
237+
/// <returns>
238+
/// A Task with an enumerable of the type of the entity
239+
/// </returns>
230240
public async Task<IEnumerable<TEntity>> QueryAsync<TEntity>(string commandText, object whereParams = null)
231241
{
232242
LogSqlCommand(commandText, whereParams);
@@ -237,7 +247,7 @@ public async Task<IEnumerable<TEntity>> QueryAsync<TEntity>(string commandText,
237247
/// Inserts the specified entity without triggering events.
238248
/// </summary>
239249
/// <param name="entity">The entity.</param>
240-
/// <returns></returns>
250+
/// <returns>The number of rows inserted</returns>
241251
/// <exception cref="System.ArgumentOutOfRangeException">entity - The object type must be registered as ILiteDbSet</exception>
242252
public int Insert(object entity)
243253
{
@@ -252,7 +262,7 @@ public int Insert(object entity)
252262
/// Inserts the asynchronous without triggering events.
253263
/// </summary>
254264
/// <param name="entity">The entity.</param>
255-
/// <returns></returns>
265+
/// <returns>A Task with the total number of rows inserted</returns>
256266
public async Task<int> InsertAsync(object entity)
257267
{
258268
var set = Set(entity.GetType());

0 commit comments

Comments
 (0)