angelsix / dna-framework Goto Github PK
View Code? Open in Web Editor NEWA cross-platform base framework useful for all projects that use .Net Core
License: MIT License
A cross-platform base framework useful for all projects that use .Net Core
License: MIT License
at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) at Microsoft.Extensions.Logging.LoggerMessage.<>c__DisplayClass10_0
6.b__0(ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, Exception exception)
at Microsoft.EntityFrameworkCore.Diagnostics.EventDefinition6.Log[TLoggerCategory](IDiagnosticsLogger
1 logger, WarningBehavior warningBehavior, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, TParam5 arg5, TParam6 arg6, Exception exception)
at Microsoft.EntityFrameworkCore.Internal.RelationalLoggerExtensions.CommandError(IDiagnosticsLogger1 diagnostics, DbCommand command, DbCommandMethod executeMethod, Guid commandId, Guid connectionId, Exception exception, Boolean async, DateTimeOffset startTime, TimeSpan duration) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary
2 parameterValues)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteRelationalConnection.EnableForeignKeys()
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteRelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteDatabaseCreator.Exists()
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.ExistsAsync(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at KeitriPOS.Relational.ClientDataStore.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at KeitriPOS.App.d__1.MoveNext() in D:\Projects\WPF\KeitriPOS_v2\KeitriPOS\App.xaml.cs:line 51
Hi,
I use your framework on many project and I'm almost fully satisfy of it. You did a great job.
My last point of disappointment is the fact that we don't log the log level on the log file. Why you don't use them on the log file ?
Or may we can and I don't understand how to activate them.
Anyway great job and thank you.
The construction.Provider always return null.
How to access it, I thought it fixed along ago.
I've updated my server project to ASP.NET Core 3 and have tried to implement Dna.Framework.AspNet. I've followed this guide and made the following changes related to Dna:
Program.cs
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseDnaFramework(construct =>
{
// Add file logger
construct.AddFileLogger();
});
webBuilder.UseStartup<Startup>();
});
It builds and runs, but the DI shortcuts don't work (ie. DI.ApplicationDbContext) and throws System.InvalidOperationException: 'Cannot resolve scoped service 'xxx.ApplicationDbContext' from root provider.'
Any ideas?
When calling Framework.Environment.IsDevelopment
always returns false:
The #if RELEASE is checked when the NuGet package is compiled.
The best solution I found was making a method that sets the IsDevelopment with a conditional attribute and calling that method from outside the NuGet Package.
[Conditional("DEBUG")]
public void SetIsDevelopment() => IsDevelopment = true;
But this only works if you call the method from outside the NuGet Package, otherwise it will not work.
Hi, in the file: dna-framework/Source/Dna.Framework/Logging/File/FileLogger.cs
// Get current time
var currentTime = DateTimeOffset.Now.ToString("yyyy-MM-dd hh:mm:ss");
the problem is with the "hh" it only gives time based on AM & PM, a possible solution is to replace it with "HH" (24h basis).
If you build the framework without any loggers, the 'Build()' function will fail.
Example:
new FrameworkConstruction().Build();
Hi,
when I was testing the HttpEndpointChecker I found that when the app is launched offline the HttpEndpointChecker doesnt fire the "stateChangedCallback", hence the app wont be aware that it's offline and the offline bar wont show after setting the offline bar to Collapsed by default (Online by default), I digged in the Framework code and I found that this boolean is set to false by default:
public bool Responsive { get; set; }
Therefor the event doesnt fire.
if (responsive != Responsive)
{
Responsive = responsive;
mStateChangedCallback?.Invoke(responsive);
}
A possible solution to this is to simply set Responsive to "null" and add a condition "Responsive != null" next to the "responsive != Responsive"
Thank you for reading this.
When attempting to log to a file and the directory doesn't exist the call fails.
Need ensure directory of log file before attempting to log.
Hi there,
Where can I find the dna-framework documentation ?
Best regards.
Hi, thank you for sharing your work!
I would like to extend the FileLogger with logging of exception stack trace (configurable) and configurable format string for writing timestamps (I sometimes need milliseconds). The default behavior will be unchanged.
For my own project, I also want to add a helper for logging some information about user environment (useful for troubleshooting Desktop apps).
@angelsix , would you mind checking a couple of pull requests related to the above suggestions, or should I rather not bother you with these? ;)
Hi, I'm following your WPF UI Tutorials series, I'm on "part 35 - Log in to Web Server", I'm getting this exception when I click log in:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Dna.Framework, Version=1.0.7.15, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'
I googled it for 2 days now, tried many suggested solutions but nothing seems to work.
PS: Thank you so much for the series, so helpful, Much love
Why url checking every 20 seconds?
I want to check url every 2 or 3 seconds.
I set interval 2000 milliseconds but it is checking every 20 seconds
This is my code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.