diff --git a/dotnet/.editorconfig b/dotnet/.editorconfig
new file mode 100644
index 00000000..e36f7c76
--- /dev/null
+++ b/dotnet/.editorconfig
@@ -0,0 +1,28 @@
+; EditorConfig to support per-solution formatting.
+; Use the EditorConfig VS add-in to make this work.
+; http://editorconfig.org/
+;
+; Here are some resources for what's supported for .NET/C#
+; https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
+; https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017
+;
+; Be **careful** editing this because some of the rules don't support adding a severity level
+; For instance if you change to `dotnet_sort_system_directives_first = true:warning` (adding `:warning`)
+; then the rule will be silently ignored.
+
+; This is the default for the codeline.
+root = true
+
+[*]
+indent_style = space
+charset = utf-8-bom
+trim_trailing_whitespace = true
+insert_final_newline = true
+end_of_line = lf
+
+[*.{cs,sln}]
+indent_size = 4
+dotnet_sort_system_directives_first = true
+
+[*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks,json,md,ts,csroj}]
+indent_size = 2
diff --git a/dotnet/.gitignore b/dotnet/.gitignore
new file mode 100644
index 00000000..69824299
--- /dev/null
+++ b/dotnet/.gitignore
@@ -0,0 +1,4 @@
+.vs/
+Debug/
+Release/
+obj/
diff --git a/dotnet/CodeCoverage.runsettings b/dotnet/CodeCoverage.runsettings
new file mode 100644
index 00000000..d698e28e
--- /dev/null
+++ b/dotnet/CodeCoverage.runsettings
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+ .*KeepTrack\..*\.dll$
+
+
+ .*KeepTrack.*Tests\.dll$
+ .*Moq.*
+
+
+
+
+ ^System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute$
+
+
+
+ True
+ True
+ True
+ False
+
+
+
+
+
+
diff --git a/dotnet/KeepTrack.sln b/dotnet/KeepTrack.sln
new file mode 100644
index 00000000..e63bdfcf
--- /dev/null
+++ b/dotnet/KeepTrack.sln
@@ -0,0 +1,61 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29409.12
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dal.MongoDb", "src\Dal.MongoDb\Dal.MongoDb.csproj", "{6A10979B-FBAE-488A-B5BC-0E45716DFE88}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{215584EC-8DFC-4DAD-B3A0-D419CEC24260}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{61C528CD-816E-4FC5-ADFA-C5C25A3C4052}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Components", "Components", "{59B2BDBC-F7DE-47F8-880E-248202630B1A}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Car", "Car", "{A52EF787-A7DD-4F2F-99B1-9A62CBE1DE5B}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Movie", "Movie", "{A6A8275A-6360-43E7-AB5A-D8A1E96BED06}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "src\ConsoleApp\ConsoleApp.csproj", "{09DBB876-546F-40EF-B1D8-D0FDAE02E80D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarComponent.Domain", "src\CarComponent.Domain\CarComponent.Domain.csproj", "{A2193B19-8191-4A28-9E64-23D9083A0531}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CarComponent.Infrastructure.MongoDb", "src\CarComponent.Infrastructure.MongoDb\CarComponent.Infrastructure.MongoDb.csproj", "{F7250DAA-718B-44FB-990B-AD7DFC488AA7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6A10979B-FBAE-488A-B5BC-0E45716DFE88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6A10979B-FBAE-488A-B5BC-0E45716DFE88}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6A10979B-FBAE-488A-B5BC-0E45716DFE88}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6A10979B-FBAE-488A-B5BC-0E45716DFE88}.Release|Any CPU.Build.0 = Release|Any CPU
+ {09DBB876-546F-40EF-B1D8-D0FDAE02E80D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {09DBB876-546F-40EF-B1D8-D0FDAE02E80D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {09DBB876-546F-40EF-B1D8-D0FDAE02E80D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {09DBB876-546F-40EF-B1D8-D0FDAE02E80D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A2193B19-8191-4A28-9E64-23D9083A0531}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A2193B19-8191-4A28-9E64-23D9083A0531}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A2193B19-8191-4A28-9E64-23D9083A0531}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A2193B19-8191-4A28-9E64-23D9083A0531}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F7250DAA-718B-44FB-990B-AD7DFC488AA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F7250DAA-718B-44FB-990B-AD7DFC488AA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F7250DAA-718B-44FB-990B-AD7DFC488AA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F7250DAA-718B-44FB-990B-AD7DFC488AA7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {6A10979B-FBAE-488A-B5BC-0E45716DFE88} = {215584EC-8DFC-4DAD-B3A0-D419CEC24260}
+ {A52EF787-A7DD-4F2F-99B1-9A62CBE1DE5B} = {59B2BDBC-F7DE-47F8-880E-248202630B1A}
+ {A6A8275A-6360-43E7-AB5A-D8A1E96BED06} = {59B2BDBC-F7DE-47F8-880E-248202630B1A}
+ {09DBB876-546F-40EF-B1D8-D0FDAE02E80D} = {61C528CD-816E-4FC5-ADFA-C5C25A3C4052}
+ {A2193B19-8191-4A28-9E64-23D9083A0531} = {A52EF787-A7DD-4F2F-99B1-9A62CBE1DE5B}
+ {F7250DAA-718B-44FB-990B-AD7DFC488AA7} = {A52EF787-A7DD-4F2F-99B1-9A62CBE1DE5B}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {876333E7-72D4-4F43-B6F9-9432CA2B7425}
+ EndGlobalSection
+EndGlobal
diff --git a/dotnet/src/CarComponent.Domain/CarComponent.Domain.csproj b/dotnet/src/CarComponent.Domain/CarComponent.Domain.csproj
new file mode 100644
index 00000000..7def1f04
--- /dev/null
+++ b/dotnet/src/CarComponent.Domain/CarComponent.Domain.csproj
@@ -0,0 +1,15 @@
+
+
+
+ netstandard2.1
+ KeepTrack.CarComponent.Domain
+ KeepTrack.CarComponent.Domain
+ {A2193B19-8191-4A28-9E64-23D9083A0531}
+
+
+
+ full
+ true
+
+
+
diff --git a/dotnet/src/CarComponent.Domain/CarHistoryModel.cs b/dotnet/src/CarComponent.Domain/CarHistoryModel.cs
new file mode 100644
index 00000000..bdf5aad7
--- /dev/null
+++ b/dotnet/src/CarComponent.Domain/CarHistoryModel.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace KeepTrack.CarComponent.Domain
+{
+ public class CarHistoryModel
+ {
+ public string Id { get; set; }
+ public string CarId { get; set; }
+ public DateTime HistoryDate { get; set; }
+ }
+}
diff --git a/dotnet/src/CarComponent.Domain/CarModel.cs b/dotnet/src/CarComponent.Domain/CarModel.cs
new file mode 100644
index 00000000..8fa7ad59
--- /dev/null
+++ b/dotnet/src/CarComponent.Domain/CarModel.cs
@@ -0,0 +1,13 @@
+namespace KeepTrack.CarComponent.Domain
+{
+ public class CarModel
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+
+ public override string ToString()
+ {
+ return $"Car ID=\"{Id}\", Name=\"{Name}\"";
+ }
+ }
+}
diff --git a/dotnet/src/CarComponent.Domain/ICarHistoryRepository.cs b/dotnet/src/CarComponent.Domain/ICarHistoryRepository.cs
new file mode 100644
index 00000000..b97cf8b9
--- /dev/null
+++ b/dotnet/src/CarComponent.Domain/ICarHistoryRepository.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace KeepTrack.CarComponent.Domain
+{
+ public interface ICarHistoryRepository
+ {
+ Task FindOneAsync(string id);
+ Task> FindAllAsync(string carId);
+ }
+}
diff --git a/dotnet/src/CarComponent.Domain/ICarRepository.cs b/dotnet/src/CarComponent.Domain/ICarRepository.cs
new file mode 100644
index 00000000..3473fe39
--- /dev/null
+++ b/dotnet/src/CarComponent.Domain/ICarRepository.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace KeepTrack.CarComponent.Domain
+{
+ public interface ICarRepository
+ {
+ Task FindOneAsync(string id);
+ }
+}
diff --git a/dotnet/src/CarComponent.Infrastructure.MongoDb/CarComponent.Infrastructure.MongoDb.csproj b/dotnet/src/CarComponent.Infrastructure.MongoDb/CarComponent.Infrastructure.MongoDb.csproj
new file mode 100644
index 00000000..59209cd5
--- /dev/null
+++ b/dotnet/src/CarComponent.Infrastructure.MongoDb/CarComponent.Infrastructure.MongoDb.csproj
@@ -0,0 +1,23 @@
+
+
+
+ netstandard2.1
+ KeepTrack.CarComponent.Infrastructure.MongoDb
+ KeepTrack.CarComponent.Infrastructure.MongoDb
+ {F7250DAA-718B-44FB-990B-AD7DFC488AA7}
+
+
+
+ full
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dotnet/src/CarComponent.Infrastructure.MongoDb/DependencyInjection/ServiceCollectionExtensions.cs b/dotnet/src/CarComponent.Infrastructure.MongoDb/DependencyInjection/ServiceCollectionExtensions.cs
new file mode 100644
index 00000000..d19ee3fd
--- /dev/null
+++ b/dotnet/src/CarComponent.Infrastructure.MongoDb/DependencyInjection/ServiceCollectionExtensions.cs
@@ -0,0 +1,22 @@
+using System;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+
+namespace KeepTrack.CarComponent.Infrastructure.MongoDb.DependencyInjection
+{
+ public static class ServiceCollectionExtensions
+ {
+ public static IServiceCollection AddCarInfrastructureMongoDb(this IServiceCollection services)
+ {
+ if (services == null)
+ {
+ throw new ArgumentNullException(nameof(services));
+ }
+
+ services.TryAddTransient();
+ services.TryAddTransient();
+
+ return services;
+ }
+ }
+}
diff --git a/dotnet/src/CarComponent.Infrastructure.MongoDb/Entities/Car.cs b/dotnet/src/CarComponent.Infrastructure.MongoDb/Entities/Car.cs
new file mode 100644
index 00000000..2818c947
--- /dev/null
+++ b/dotnet/src/CarComponent.Infrastructure.MongoDb/Entities/Car.cs
@@ -0,0 +1,13 @@
+using MongoDB.Bson;
+using MongoDB.Bson.Serialization.Attributes;
+
+namespace KeepTrack.CarComponent.Infrastructure.MongoDb.Entities
+{
+ public class Car
+ {
+ [BsonId]
+ public string Id { get; set; }
+ [BsonElement("commercial_name")]
+ public string Name { get; set; }
+ }
+}
diff --git a/dotnet/src/CarComponent.Infrastructure.MongoDb/Entities/CarHistory.cs b/dotnet/src/CarComponent.Infrastructure.MongoDb/Entities/CarHistory.cs
new file mode 100644
index 00000000..34326fc3
--- /dev/null
+++ b/dotnet/src/CarComponent.Infrastructure.MongoDb/Entities/CarHistory.cs
@@ -0,0 +1,16 @@
+using System;
+using MongoDB.Bson;
+using MongoDB.Bson.Serialization.Attributes;
+
+namespace KeepTrack.CarComponent.Infrastructure.MongoDb.Entities
+{
+ public class CarHistory
+ {
+ [BsonId]
+ public ObjectId Id { get; set; }
+ [BsonElement("car_id")]
+ public string CarId { get; set; }
+ [BsonElement("history_date")]
+ public DateTime HistoryDate { get; set; }
+ }
+}
diff --git a/dotnet/src/CarComponent.Infrastructure.MongoDb/MappingProfiles/CarMappingProfile.cs b/dotnet/src/CarComponent.Infrastructure.MongoDb/MappingProfiles/CarMappingProfile.cs
new file mode 100644
index 00000000..f150d655
--- /dev/null
+++ b/dotnet/src/CarComponent.Infrastructure.MongoDb/MappingProfiles/CarMappingProfile.cs
@@ -0,0 +1,18 @@
+using AutoMapper;
+
+namespace KeepTrack.CarComponent.Infrastructure.MongoDb.MappingProfiles
+{
+ public class CarMappingProfile : Profile
+ {
+ public override string ProfileName
+ {
+ get { return "KeepTrackCarInfrastructureMongoDbMappingProfile"; }
+ }
+
+ public CarMappingProfile()
+ {
+ CreateMap();
+ CreateMap();
+ }
+ }
+}
diff --git a/dotnet/src/CarComponent.Infrastructure.MongoDb/Repositories/CarHistoryRepository.cs b/dotnet/src/CarComponent.Infrastructure.MongoDb/Repositories/CarHistoryRepository.cs
new file mode 100644
index 00000000..4077c6b6
--- /dev/null
+++ b/dotnet/src/CarComponent.Infrastructure.MongoDb/Repositories/CarHistoryRepository.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using AutoMapper;
+using KeepTrack.CarComponent.Domain;
+using KeepTrack.CarComponent.Infrastructure.MongoDb.Entities;
+using Microsoft.Extensions.Logging;
+using MongoDB.Bson;
+using MongoDB.Driver;
+using Withywoods.Dal.MongoDb;
+using Withywoods.Dal.MongoDb.Repositories;
+
+namespace KeepTrack.CarComponent.Infrastructure.Repositories
+{
+ public class CarHistoryRepository : RepositoryBase, ICarHistoryRepository
+ {
+ public CarHistoryRepository(IMongoDbContext mongoDbContext, ILogger logger, IMapper mapper)
+ : base(mongoDbContext, logger, mapper)
+ {
+ }
+
+ protected override string CollectionName => "car_history";
+
+ public async Task FindOneAsync(string id)
+ {
+ if (!ObjectId.TryParse(id, out var objectId))
+ {
+ throw new System.Exception($"Cannot find the car history. \"{id}\" is not a valid id.");
+ }
+
+ var collection = GetCollection();
+ var dbEntries = await collection.FindAsync(x => x.Id == objectId);
+ return Mapper.Map(dbEntries.FirstOrDefault());
+ }
+
+ public async Task> FindAllAsync(string carId)
+ {
+ var collection = GetCollection();
+ var dbEntries = await collection.FindAsync(x => x.CarId == carId);
+ return Mapper.Map>(dbEntries.ToList());
+ }
+ }
+}
diff --git a/dotnet/src/CarComponent.Infrastructure.MongoDb/Repositories/CarRepository.cs b/dotnet/src/CarComponent.Infrastructure.MongoDb/Repositories/CarRepository.cs
new file mode 100644
index 00000000..98c4591a
--- /dev/null
+++ b/dotnet/src/CarComponent.Infrastructure.MongoDb/Repositories/CarRepository.cs
@@ -0,0 +1,34 @@
+using System.Threading.Tasks;
+using AutoMapper;
+using KeepTrack.CarComponent.Domain;
+using KeepTrack.CarComponent.Infrastructure.MongoDb.Entities;
+using Microsoft.Extensions.Logging;
+using MongoDB.Bson;
+using MongoDB.Driver;
+using Withywoods.Dal.MongoDb;
+using Withywoods.Dal.MongoDb.Repositories;
+
+namespace KeepTrack.CarComponent.Infrastructure.Repositories
+{
+ public class CarRepository : RepositoryBase, ICarRepository
+ {
+ public CarRepository(IMongoDbContext mongoDbContext, ILogger logger, IMapper mapper)
+ : base(mongoDbContext, logger, mapper)
+ {
+ }
+
+ protected override string CollectionName => "car";
+
+ public async Task FindOneAsync(string id)
+ {
+ if (string.IsNullOrEmpty(id))
+ {
+ throw new System.Exception($"Cannot find a car. \"{id}\" is not a valid id.");
+ }
+
+ var collection = GetCollection();
+ var dbEntries = await collection.FindAsync(x => x.Id == id);
+ return Mapper.Map(dbEntries.FirstOrDefault());
+ }
+ }
+}
diff --git a/dotnet/src/ConsoleApp/AppConfiguration.cs b/dotnet/src/ConsoleApp/AppConfiguration.cs
new file mode 100644
index 00000000..dafe8925
--- /dev/null
+++ b/dotnet/src/ConsoleApp/AppConfiguration.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using Microsoft.Extensions.Configuration;
+using Withywoods.Dal.MongoDb;
+using Withywoods.Dal.MongoDb.Serialization;
+
+namespace KeepTrack.ConsoleApp
+{
+ public class AppConfiguration : IMongoDbConfiguration
+ {
+ #region Constructor & private fields
+
+ private readonly IConfigurationRoot _configurationRoot;
+
+ public AppConfiguration(IConfigurationRoot configurationRoot)
+ {
+ _configurationRoot = configurationRoot;
+ }
+
+ #endregion
+
+ #region IMongoDbConfiguration properties
+
+ public string ConnectionString => _configurationRoot.GetSection("KeepTrack_MongoDbConnectionString").Value;
+
+ public string DatabaseName => "inventory";
+
+ public List SerializationConventions => new List { ConventionValues.CamelCaseElementName, ConventionValues.EnumAsString,
+ ConventionValues.IgnoreExtraElements, ConventionValues.IgnoreNullValues };
+
+ #endregion
+ }
+}
diff --git a/dotnet/src/ConsoleApp/ConsoleApp.csproj b/dotnet/src/ConsoleApp/ConsoleApp.csproj
new file mode 100644
index 00000000..52fa8ab9
--- /dev/null
+++ b/dotnet/src/ConsoleApp/ConsoleApp.csproj
@@ -0,0 +1,33 @@
+
+
+
+ Exe
+ netcoreapp3.0
+ KeepTrack.ConsoleApp
+ KeepTrack.ConsoleApp
+ {3C4E6452-A0A7-4860-83F1-4AF7A0CF1E57}
+
+
+
+ full
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dotnet/src/ConsoleApp/Program.cs b/dotnet/src/ConsoleApp/Program.cs
new file mode 100644
index 00000000..e11c9179
--- /dev/null
+++ b/dotnet/src/ConsoleApp/Program.cs
@@ -0,0 +1,134 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Threading.Tasks;
+using AutoMapper;
+using CommandLine;
+using KeepTrack.CarComponent.Domain;
+using KeepTrack.CarComponent.Infrastructure.MongoDb.DependencyInjection;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using MongoDB.Bson;
+using Withywoods.Dal.MongoDb.DependencyInjection;
+using Withywoods.Dal.MongoDb.MappingConverters;
+
+namespace KeepTrack.ConsoleApp
+{
+ static class Program
+ {
+ #region Inner class
+
+ public class CommandLineOptions
+ {
+ [Option('v', "verbose", Required = false, HelpText = "Set output to verbose messages.")]
+ public bool IsVerbose { get; set; }
+
+ [Option('a', "action", Required = true, HelpText = "Action (possible values: \"CarDemo\").")]
+ public string Action { get; set; }
+
+ [Option("id", Required = false, HelpText = "ID.")]
+ public string Id { get; set; }
+ }
+
+ #endregion
+
+ #region Entry point
+
+ private async static Task Main(string[] args)
+ {
+ await Parser.Default.ParseArguments(args)
+ .MapResult(
+ (CommandLineOptions opts) => RunOptionsAndReturnExitCode(opts),
+ errs => Task.FromResult(HandleParseError(errs))
+ );
+ }
+
+ private async static Task RunOptionsAndReturnExitCode(CommandLineOptions opts)
+ {
+ LogVerbose(opts, "Create the service provider");
+
+ var configuration = CreateConfiguration();
+
+ using (var serviceProvider = CreateServiceProvider(configuration))
+ {
+ if (opts.Action == "CarDemo")
+ {
+ var id = opts.Id;
+
+ LogVerbose(opts, "Query the car collection");
+
+ var carRepository = serviceProvider.GetService();
+ var car = await carRepository.FindOneAsync(id);
+
+ Console.WriteLine($"Car found: {car}");
+
+ LogVerbose(opts, "Query the car history collection");
+
+ var carHistoryRepository = serviceProvider.GetService();
+ var history = await carHistoryRepository.FindAllAsync(id);
+
+ Console.WriteLine($"Car history found: {history.Count}");
+ }
+
+ return 0;
+ }
+ }
+
+ private static int HandleParseError(IEnumerable errs)
+ {
+ return -2;
+ }
+
+ #endregion
+
+ #region Private helpers
+
+ private static IConfigurationRoot CreateConfiguration()
+ {
+ return new ConfigurationBuilder()
+ .SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location))
+ .AddJsonFile($"appsettings.json", true, true)
+ .AddEnvironmentVariables()
+ .Build();
+ }
+
+ private static ServiceProvider CreateServiceProvider(IConfigurationRoot configuration)
+ {
+ var serviceCollection = new ServiceCollection()
+ .AddLogging(builder => { builder.AddConsole(); })
+ .AddSingleton(configuration)
+ .AddCarInfrastructureMongoDb()
+ .AddMongoDbContext();
+
+ ConfigureAutoMapper(serviceCollection);
+
+ return serviceCollection.BuildServiceProvider();
+ }
+
+ private static void ConfigureAutoMapper(IServiceCollection serviceCollection)
+ {
+ var mappingConfig = new MapperConfiguration(x =>
+ {
+ x.AddProfile(new CarComponent.Infrastructure.MongoDb.MappingProfiles.CarMappingProfile());
+ x.CreateMap().ConvertUsing();
+ x.CreateMap().ConvertUsing();
+ x.AllowNullCollections = true;
+ });
+ var mapper = mappingConfig.CreateMapper();
+ mapper.ConfigurationProvider.AssertConfigurationIsValid();
+ serviceCollection.AddSingleton(mapper);
+ }
+
+ private static void LogVerbose(CommandLineOptions opts, string message)
+ {
+ if (opts.IsVerbose)
+ {
+ Console.WriteLine(message);
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/dotnet/src/ConsoleApp/Properties/launchSettings.json b/dotnet/src/ConsoleApp/Properties/launchSettings.json
new file mode 100644
index 00000000..83f82674
--- /dev/null
+++ b/dotnet/src/ConsoleApp/Properties/launchSettings.json
@@ -0,0 +1,8 @@
+{
+ "profiles": {
+ "ConsoleApp": {
+ "commandName": "Project",
+ "commandLineArgs": "-a CarDemo --id MyCar"
+ }
+ }
+}
\ No newline at end of file
diff --git a/dotnet/src/Dal.MongoDb/Dal.MongoDb.csproj b/dotnet/src/Dal.MongoDb/Dal.MongoDb.csproj
new file mode 100644
index 00000000..c458d657
--- /dev/null
+++ b/dotnet/src/Dal.MongoDb/Dal.MongoDb.csproj
@@ -0,0 +1,20 @@
+
+
+
+ netstandard2.1
+ KeepTrack.Dal.MongoDb
+ KeepTrack.Dal.MongoDb
+ {6A10979B-FBAE-488A-B5BC-0E45716DFE88}
+
+
+
+ full
+ true
+
+
+
+
+
+
+
+