Compare commits
1 Commits
feature/da
...
feature/op
| Author | SHA1 | Date | |
|---|---|---|---|
| c679197fa5 |
@@ -1,30 +0,0 @@
|
|||||||
**/.classpath
|
|
||||||
**/.dockerignore
|
|
||||||
**/.env
|
|
||||||
**/.git
|
|
||||||
**/.gitignore
|
|
||||||
**/.project
|
|
||||||
**/.settings
|
|
||||||
**/.toolstarget
|
|
||||||
**/.vs
|
|
||||||
**/.vscode
|
|
||||||
**/*.*proj.user
|
|
||||||
**/*.dbmdl
|
|
||||||
**/*.jfm
|
|
||||||
**/azds.yaml
|
|
||||||
**/bin
|
|
||||||
**/charts
|
|
||||||
**/docker-compose*
|
|
||||||
**/Dockerfile*
|
|
||||||
**/node_modules
|
|
||||||
**/npm-debug.log
|
|
||||||
**/obj
|
|
||||||
**/secrets.dev.yaml
|
|
||||||
**/values.dev.yaml
|
|
||||||
LICENSE
|
|
||||||
README.md
|
|
||||||
!**/.gitignore
|
|
||||||
!.git/HEAD
|
|
||||||
!.git/config
|
|
||||||
!.git/packed-refs
|
|
||||||
!.git/refs/heads/**
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using SmartHouse.Services.Database.Models;
|
|
||||||
|
|
||||||
var host = Host.CreateDefaultBuilder(args)
|
|
||||||
.ConfigureServices((context, services) =>
|
|
||||||
{
|
|
||||||
services.AddDbContext<SmartHouseContext>(options =>
|
|
||||||
options.UseSqlServer(context.Configuration.GetConnectionString("SmartHouse")));
|
|
||||||
|
|
||||||
// services.AddHostedService<YourBackgroundService>();
|
|
||||||
})
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
await host.RunAsync();
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
|
|
||||||
#nullable disable
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using SmartHouse.Services.Database.Models;
|
|
||||||
|
|
||||||
namespace SmartHouse.Services.Database.Data;
|
|
||||||
|
|
||||||
public partial class SmartHouseDbContext : DbContext
|
|
||||||
{
|
|
||||||
public SmartHouseDbContext()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public SmartHouseDbContext(DbContextOptions<SmartHouseDbContext> options)
|
|
||||||
: base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual DbSet<DailyReading> DailyReadings { get; set; }
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
namespace SmartHouse.Services.Database.Entities
|
|
||||||
{
|
|
||||||
public class Device
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string Name { get; set; } = null!;
|
|
||||||
public string? Location { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
|
|
||||||
#nullable disable
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace SmartHouse.Services.Database.Models;
|
|
||||||
|
|
||||||
[Table("DailyReading", Schema = "SunCast")]
|
|
||||||
public partial class DailyReading
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
|
|
||||||
public double SuncastValue { get; set; }
|
|
||||||
|
|
||||||
public double GrowattValue { get; set; }
|
|
||||||
|
|
||||||
public double DiffValue { get; set; }
|
|
||||||
|
|
||||||
public double DiffProcent { get; set; }
|
|
||||||
}
|
|
||||||
@@ -10,8 +10,4 @@
|
|||||||
<ProjectReference Include="..\SmartHouse.Services.ServiceDefaults\SmartHouse.Services.ServiceDefaults.csproj" />
|
<ProjectReference Include="..\SmartHouse.Services.ServiceDefaults\SmartHouse.Services.ServiceDefaults.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.22" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"CodeGenerationMode": 4,
|
|
||||||
"ContextClassName": "SmartHouseDbContext",
|
|
||||||
"ContextNamespace": "",
|
|
||||||
"FilterSchemas": false,
|
|
||||||
"IncludeConnectionString": true,
|
|
||||||
"IrregularWords": null,
|
|
||||||
"MinimumProductVersion": "2.6.1301",
|
|
||||||
"ModelNamespace": null,
|
|
||||||
"OutputContextPath": "Data",
|
|
||||||
"OutputPath": "Models",
|
|
||||||
"PluralRules": null,
|
|
||||||
"PreserveCasingWithRegex": true,
|
|
||||||
"ProjectRootNamespace": "SmartHouse.Services.Database",
|
|
||||||
"Schemas": null,
|
|
||||||
"SelectedHandlebarsLanguage": 2,
|
|
||||||
"SelectedToBeGenerated": 0,
|
|
||||||
"SingularRules": null,
|
|
||||||
"T4TemplatePath": null,
|
|
||||||
"Tables": [
|
|
||||||
{
|
|
||||||
"Name": "[SunCast].[DailyReading]",
|
|
||||||
"ObjectType": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UiHint": null,
|
|
||||||
"UncountableWords": null,
|
|
||||||
"UseAsyncStoredProcedureCalls": true,
|
|
||||||
"UseBoolPropertiesWithoutDefaultSql": false,
|
|
||||||
"UseDatabaseNames": true,
|
|
||||||
"UseDatabaseNamesForRoutines": true,
|
|
||||||
"UseDateOnlyTimeOnly": true,
|
|
||||||
"UseDbContextSplitting": false,
|
|
||||||
"UseDecimalDataAnnotationForSprocResult": true,
|
|
||||||
"UseFluentApiOnly": false,
|
|
||||||
"UseHandleBars": false,
|
|
||||||
"UseHierarchyId": false,
|
|
||||||
"UseInflector": true,
|
|
||||||
"UseInternalAccessModifiersForSprocsAndFunctions": false,
|
|
||||||
"UseLegacyPluralizer": false,
|
|
||||||
"UseManyToManyEntity": true,
|
|
||||||
"UseNoDefaultConstructor": false,
|
|
||||||
"UseNoNavigations": false,
|
|
||||||
"UseNoObjectFilter": false,
|
|
||||||
"UseNodaTime": false,
|
|
||||||
"UseNullableReferences": false,
|
|
||||||
"UsePrefixNavigationNaming": false,
|
|
||||||
"UseSchemaFolders": false,
|
|
||||||
"UseSchemaNamespaces": false,
|
|
||||||
"UseSpatial": false,
|
|
||||||
"UseT4": false,
|
|
||||||
"UseT4Split": false
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
|
||||||
|
|
||||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
|
||||||
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS base
|
|
||||||
USER $APP_UID
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
|
|
||||||
# This stage is used to build the service project
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
|
||||||
ARG BUILD_CONFIGURATION=Release
|
|
||||||
WORKDIR /src
|
|
||||||
COPY ["SmartHouse.Services.DbUP/SmartHouse.Services.DbUP.csproj", "SmartHouse.Services.DbUP/"]
|
|
||||||
RUN dotnet restore "./SmartHouse.Services.DbUP/SmartHouse.Services.DbUP.csproj"
|
|
||||||
COPY . .
|
|
||||||
WORKDIR "/src/SmartHouse.Services.DbUP"
|
|
||||||
RUN dotnet build "./SmartHouse.Services.DbUP.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
|
||||||
|
|
||||||
# This stage is used to publish the service project to be copied to the final stage
|
|
||||||
FROM build AS publish
|
|
||||||
ARG BUILD_CONFIGURATION=Release
|
|
||||||
RUN dotnet publish "./SmartHouse.Services.DbUP.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
|
||||||
|
|
||||||
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
|
||||||
FROM base AS final
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=publish /app/publish .
|
|
||||||
ENTRYPOINT ["dotnet", "SmartHouse.Services.DbUP.dll"]
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using DbUp;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
var connectionString = "Server=vps.maximuss.dk;Database=SmartHouse;Trusted_Connection=True;MultipleActiveResultSets=true";
|
|
||||||
EnsureDatabase.For.SqlDatabase(connectionString);
|
|
||||||
var upgrader =
|
|
||||||
DeployChanges.To
|
|
||||||
.SqlDatabase(connectionString)
|
|
||||||
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
|
|
||||||
.LogToConsole()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var result = upgrader.PerformUpgrade();
|
|
||||||
|
|
||||||
if (!result.Successful)
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
Console.WriteLine(result.Error);
|
|
||||||
Console.ResetColor();
|
|
||||||
#if DEBUG
|
|
||||||
Console.ReadLine();
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.WriteLine("Success!");
|
|
||||||
Console.ResetColor();
|
|
||||||
return 0;
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"profiles": {
|
|
||||||
"SmartHouse.Services.DbUP": {
|
|
||||||
"commandName": "Project"
|
|
||||||
},
|
|
||||||
"Container (Dockerfile)": {
|
|
||||||
"commandName": "Docker"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
create schema SunCast
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
CREATE TABLE SunCast.DailyReading
|
|
||||||
(
|
|
||||||
Id int NOT NULL IDENTITY (1, 1),
|
|
||||||
Date datetime2(7) NOT NULL,
|
|
||||||
SuncastValue float(53) NOT NULL,
|
|
||||||
GrowattValue float(53) NOT NULL,
|
|
||||||
DiffValue float(53) NOT NULL,
|
|
||||||
DiffProcent float(53) NOT NULL
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
ALTER TABLE SunCast.Dailyreading SET (LOCK_ESCALATION = TABLE)
|
|
||||||
GO
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
ALTER TABLE SunCast.DailyReading ADD CONSTRAINT
|
|
||||||
PK_DailyReading PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
Id
|
|
||||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="dbup" Version="5.0.41" />
|
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,13 +1,9 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using SmartHouse.Services.Database;
|
|
||||||
using SmartHouse.Services.EVCharging;
|
using SmartHouse.Services.EVCharging;
|
||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder(args);
|
var builder = Host.CreateApplicationBuilder(args);
|
||||||
|
|
||||||
builder.AddServiceDefaults();
|
builder.AddServiceDefaults();
|
||||||
builder.Services.AddHostedService<Worker>();
|
builder.Services.AddHostedService<Worker>();
|
||||||
//builder.Services.AddDbContext<SmartHouseDbContext>(options =>
|
|
||||||
// options.UseSqlServer(builder.Configuration.GetConnectionString("SmartHouseDatabase")));
|
|
||||||
|
|
||||||
var host = builder.Build();
|
var host = builder.Build();
|
||||||
host.Run();
|
host.Run();
|
||||||
@@ -8,14 +8,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="dbup-sqlserver" Version="6.0.16" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1"/>
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SmartHouse.Services.Database\SmartHouse.Services.Database.csproj" />
|
|
||||||
<ProjectReference Include="..\SmartHouse.Services.ServiceDefaults\SmartHouse.Services.ServiceDefaults.csproj" />
|
<ProjectReference Include="..\SmartHouse.Services.ServiceDefaults\SmartHouse.Services.ServiceDefaults.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using SmartHouse.Services.Helper;
|
|
||||||
|
|
||||||
|
public interface IPerfLog
|
||||||
|
{
|
||||||
|
void Info(string message, params object[] args);
|
||||||
|
void Warn(string message, params object[] args);
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class PerfLog : IPerfLog
|
public sealed class PerfLog : IPerfLog
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,90 +1,34 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
autoReload="true"
|
autoReload="true"
|
||||||
throwConfigExceptions="true"
|
throwExceptions="false"
|
||||||
internalLogLevel="Warn"
|
internalLogLevel="Off" internalLogFile="c:\temp\internal-apiservice_nlog.txt" >
|
||||||
internalLogFile="logs/nlog-internal.log">
|
|
||||||
|
|
||||||
<!-- ========================= -->
|
|
||||||
<!-- VARIABLES -->
|
|
||||||
<!-- ========================= -->
|
|
||||||
<variable name="appName" value="MyApp" />
|
|
||||||
<variable name="environment" value="${aspnet-environment:whenEmpty=Production}" />
|
|
||||||
|
|
||||||
<variable name="logRoot" value="${basedir}/logs" />
|
<variable name="logDirectory" value="${basedir}\Log\${date:format=yy}\${date:format=MM}"/>
|
||||||
<variable name="year" value="${date:format=yyyy}" />
|
|
||||||
<variable name="month" value="${date:format=MM}" />
|
|
||||||
<variable name="day" value="${date:format=dd}" />
|
|
||||||
|
|
||||||
<!-- ========================= -->
|
<extensions>
|
||||||
<!-- LAYOUTS -->
|
<add assembly="NLog.Web.AspNetCore"/>
|
||||||
<!-- ========================= -->
|
</extensions>
|
||||||
<layout name="jsonLayout" xsi:type="JsonLayout" includeAllProperties="true">
|
|
||||||
<attribute name="timestamp" layout="${date:format=o}" />
|
|
||||||
<attribute name="level" layout="${level}" />
|
|
||||||
<attribute name="logger" layout="${logger}" />
|
|
||||||
<attribute name="message" layout="${message}" />
|
|
||||||
<attribute name="exception" layout="${exception:format=ToString}" />
|
|
||||||
<attribute name="correlationId" layout="${mdlc:item=CorrelationId}" />
|
|
||||||
<attribute name="traceId" layout="${activityid}" />
|
|
||||||
<attribute name="environment" layout="${environment}" />
|
|
||||||
<attribute name="application" layout="${appName}" />
|
|
||||||
</layout>
|
|
||||||
|
|
||||||
<!-- ========================= -->
|
|
||||||
<!-- TARGETS -->
|
|
||||||
<!-- ========================= -->
|
|
||||||
<targets async="true">
|
|
||||||
|
|
||||||
<!-- Console (dev / Docker) -->
|
|
||||||
<target xsi:type="Console"
|
|
||||||
name="console"
|
|
||||||
layout="${jsonLayout}" />
|
|
||||||
|
|
||||||
<!-- App log -->
|
|
||||||
<target xsi:type="File"
|
|
||||||
name="appFile"
|
|
||||||
fileName="${logRoot}/${year}/${month}/${day}/app.log"
|
|
||||||
layout="${jsonLayout}"
|
|
||||||
concurrentWrites="true"
|
|
||||||
keepFileOpen="false" />
|
|
||||||
|
|
||||||
<!-- Error log -->
|
|
||||||
<target xsi:type="File"
|
|
||||||
name="errorFile"
|
|
||||||
fileName="${logRoot}/${year}/${month}/${day}/error.log"
|
|
||||||
layout="${jsonLayout}"
|
|
||||||
concurrentWrites="true"
|
|
||||||
keepFileOpen="false" />
|
|
||||||
|
|
||||||
<!-- Performance log -->
|
|
||||||
<target xsi:type="File"
|
|
||||||
name="performanceFile"
|
|
||||||
fileName="${logRoot}/${year}/${month}/${day}/perf.log"
|
|
||||||
layout="${jsonLayout}"
|
|
||||||
concurrentWrites="true"
|
|
||||||
keepFileOpen="false" />
|
|
||||||
|
|
||||||
|
<targets>
|
||||||
|
<target name="file" xsi:type="File" fileName="${logDirectory}\Log_${shortdate}.txt" layout="${longdate} [${pad:padding=8:fixedlength=true:PadCharacter=0:inner=${threadid}}] ${operationId} ${pad:padding=-5:fixedlength=true:inner=${level}} ${message}"/>
|
||||||
|
<target name="requestOnly" xsi:type="File" fileName="${logDirectory}\Requests_${shortdate}.txt" layout="${longdate} [${pad:padding=8:fixedlength=true:PadCharacter=0:inner=${threadid}}] ${pad:padding=-5:fixedlength=true:inner=${level}} ${message}"/>
|
||||||
|
<target name="fileFull" xsi:type="File" fileName="${logDirectory}\Log_Full_${shortdate}.txt" layout="${longdate} [${pad:padding=8:fixedlength=true:PadCharacter=0:inner=${threadid}}] ${pad:padding=-5:fixedlength=true:inner=${level}} ${pad:padding=36:fixedlength=true:PadCharacter= :inner=${operationId}} [${callsite:className=false:includeNamespace=false:fileName=true:includeSourcePath=false:methodName=true}] ${message}"/>
|
||||||
|
<target name="RequestResponseOnly" xsi:type="File" fileName="${logDirectory}\RequestResponseOnly_${shortdate}.txt" layout="${longdate} [${pad:padding=8:fixedlength=true:PadCharacter=0:inner=${threadid}}] ${pad:padding=-5:fixedlength=true:inner=${level}} ${pad:padding=36:fixedlength=true:PadCharacter= :inner=${operationId}} ${message}"/>
|
||||||
|
<target xsi:type="Debugger" name="debugger" layout="NLOG ${longdate} ${level} ${message}" />
|
||||||
|
<target name="error" xsi:type="File" fileName="${logDirectory}\Log_Error_${shortdate}.txt" layout="${longdate} [${pad:padding=8:fixedlength=true:PadCharacter=0:inner=${threadid}}] ${pad:padding=-5:fixedlength=true:inner=${level}} ${pad:padding=36:fixedlength=true:PadCharacter= :inner=${operationId}} [${callsite:className=false:includeNamespace=false:fileName=true:includeSourcePath=false:methodName=true}] ${message}"/>
|
||||||
</targets>
|
</targets>
|
||||||
|
|
||||||
<!-- ========================= -->
|
|
||||||
<!-- RULES (MINIMAL) -->
|
|
||||||
<!-- ========================= -->
|
|
||||||
<rules>
|
<rules>
|
||||||
|
<logger name="RequestResponse" minlevel="Trace" writeTo="RequestResponseOnly" final="true" />
|
||||||
<!-- Normal app flow -->
|
<logger name="*" minlevel="Trace" writeTo="file" />
|
||||||
<logger name="*" minlevel="Info" writeTo="console,appFile" />
|
<logger name="Request" minlevel="Trace" writeTo="requestOnly" />
|
||||||
|
<logger name="*" minlevel="Trace" writeTo="fileFull" />
|
||||||
<!-- Errors -->
|
<logger name="*" minlevel="Trace" writeTo="debugger" />
|
||||||
<logger name="*" minlevel="Error" writeTo="errorFile" />
|
<logger name="*" level="Error" writeTo="error" />
|
||||||
|
<logger name="Microsoft.EntityFrameworkCore.Database.Command" minlevel="Warn" writeTo="fileFull"/>
|
||||||
<!-- Performance -->
|
|
||||||
<logger name="Performance.*" minlevel="Info" writeTo="performanceFile" />
|
|
||||||
|
|
||||||
<!-- Reduce framework noise -->
|
|
||||||
<logger name="Microsoft.*" maxlevel="Info" final="true" />
|
|
||||||
<logger name="System.*" maxlevel="Warn" final="true" />
|
|
||||||
|
|
||||||
</rules>
|
</rules>
|
||||||
</nlog>
|
</nlog>
|
||||||
@@ -3,7 +3,6 @@ using Microsoft.Extensions.Hosting;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
using SmartHouse.Services.Helper;
|
|
||||||
using SmartHouse.Services.Siemens;
|
using SmartHouse.Services.Siemens;
|
||||||
|
|
||||||
// NLog internal bootstrap logger (til hvis noget går galt før hosten er oppe)
|
// NLog internal bootstrap logger (til hvis noget går galt før hosten er oppe)
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using SmartHouse.Services.Database;
|
|
||||||
using SmartHouse.Services.Database.Data;
|
|
||||||
using SmartHouse.Services.SunCast;
|
using SmartHouse.Services.SunCast;
|
||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder(args);
|
var builder = Host.CreateApplicationBuilder(args);
|
||||||
|
|
||||||
builder.AddServiceDefaults();
|
builder.AddServiceDefaults();
|
||||||
builder.Services.AddHostedService<Worker>();
|
builder.Services.AddHostedService<Worker>();
|
||||||
builder.Services.AddDbContext<SmartHouseDbContext>(options =>
|
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("SmartHouseDatabase")));
|
|
||||||
|
|
||||||
var host = builder.Build();
|
var host = builder.Build();
|
||||||
host.Run();
|
host.Run();
|
||||||
@@ -8,17 +8,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.1">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1"/>
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SmartHouse.Services.Database\SmartHouse.Services.Database.csproj" />
|
|
||||||
<ProjectReference Include="..\SmartHouse.Services.ServiceDefaults\SmartHouse.Services.ServiceDefaults.csproj" />
|
<ProjectReference Include="..\SmartHouse.Services.ServiceDefaults\SmartHouse.Services.ServiceDefaults.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -4,8 +4,5 @@
|
|||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"ConnectionStrings": {
|
|
||||||
"SmartHouse": "Data Source=localhost;Initial Catalog=SmartHouse;Integrated Security=True"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 18
|
# Visual Studio Version 18
|
||||||
VisualStudioVersion = 18.1.11312.151
|
VisualStudioVersion = 18.1.11312.151 d18.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHouse.Services.HomeAssistent", "SmartHouse.Services.HomeAssistent\SmartHouse.Services.HomeAssistent.csproj", "{5EE8D007-801D-4E7A-8F40-D89C7A61B5FD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHouse.Services.HomeAssistent", "SmartHouse.Services.HomeAssistent\SmartHouse.Services.HomeAssistent.csproj", "{5EE8D007-801D-4E7A-8F40-D89C7A61B5FD}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -19,8 +19,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHouse.Services.Service
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHouse.Services.Helper", "SmartHouse.Services.Helper\SmartHouse.Services.Helper.csproj", "{119F70AB-85D8-4715-A41D-AD8509CEC551}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHouse.Services.Helper", "SmartHouse.Services.Helper\SmartHouse.Services.Helper.csproj", "{119F70AB-85D8-4715-A41D-AD8509CEC551}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHouse.Services.DbUP", "SmartHouse.Services.DbUP\SmartHouse.Services.DbUP.csproj", "{888E76E7-9AB3-4F05-99E5-ACDE1078A4C0}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -59,10 +57,6 @@ Global
|
|||||||
{119F70AB-85D8-4715-A41D-AD8509CEC551}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{119F70AB-85D8-4715-A41D-AD8509CEC551}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{119F70AB-85D8-4715-A41D-AD8509CEC551}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{119F70AB-85D8-4715-A41D-AD8509CEC551}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{119F70AB-85D8-4715-A41D-AD8509CEC551}.Release|Any CPU.Build.0 = Release|Any CPU
|
{119F70AB-85D8-4715-A41D-AD8509CEC551}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{888E76E7-9AB3-4F05-99E5-ACDE1078A4C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{888E76E7-9AB3-4F05-99E5-ACDE1078A4C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{888E76E7-9AB3-4F05-99E5-ACDE1078A4C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{888E76E7-9AB3-4F05-99E5-ACDE1078A4C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"ConnectionStrings": {
|
|
||||||
"SmartHouse": "Data Source=localhost;Initial Catalog=SmartHouse;Integrated Security=True"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user