Yes, I set it to my timezone which is Beirut. How can I check the value of the timezone being set while running the app?
Okay, I have an update!
The date 3/11/2000 21:00:00
is indeed a UTC date representation of 4/11/2000 00:00:00+3
that I receive from the client.
When the client renders the value it is being rendered correct as 4/11/2000
.
Now, when exporting to Excel:
tempDateTime = Clock.Normalize(dateTime.Value);
tempDateTime is just the date stored in the Database in UTC format.
This line below, is keeping the date in UTC format, hence the reason I am getting this weird behavior:
value = _timeZoneConverter.Convert(tempDateTime);
Why the _timeZoneConverter is not picking up the Timezone set in the application and convertnig the date to it accordingly?
Thanks
Thanks :)
Hi, I finally made it work. In one of the entities, I need to provide a value for Id. However, Id is configured to be Identity Column.
Therefore, I had to make use of the following:
_context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.DrcYesNoDecline ON");
...
_context.SaveChanges();
_context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.DrcYesNoDecline OFF");
I noticed the following.
var item = new SpecificNeed("Child at risk");
The object item
has Id
equal to 0.
After running the line below:
var parent = _context.SpecificNeeds.Add(item).Entity;
Now parent
object has Id
with a value of -2147482647
Isn't that weird?
I run the script on the database you mean?
Hi @ismcagdas
It is: SQL Server 2016
Hello @alper,
This is the stack trace.
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.Consume(RelationalDataReader reader)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(Tuple`2 parameters)
at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_0`2.<Execute>b__0(DbContext c, TState s)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, Func`2 operation, Func`2 verifySucceeded, TState state)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IReadOnlyList`1 entries)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges()
at Tekvention.DrcApp.Migrations.Seed.DefaultSpecificNeedsCreator._create()
at Tekvention.DrcApp.Migrations.Seed.DefaultSpecificNeedsCreator.Create()
at Tekvention.DrcApp.Migrations.Seed.DefaultDrcBuilder.CreateDefaultDrcEntities()
at Tekvention.DrcApp.Migrations.Seed.DefaultDrcBuilder.Create()
at Tekvention.DrcApp.Migrations.Seed.SeedHelper.SeedHostDb(DrcAppDbContext context)
at Tekvention.DrcApp.Migrations.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action`1 contextAction)
at Tekvention.DrcApp.Migrations.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver)
at Tekvention.DrcApp.Entity.DrcAppEntityFrameworkCoreModule.PostInitialize()
at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at Abp.Modules.AbpModuleManager.StartModules()
at Abp.AbpBootstrapper.Initialize()
Actually, I am not adding any value for the ID. This code was working before. Now on the new machine it is not.
I am just seeding some values and that's where I am getting the exception.
private void _create()
{
//Create if table is empty
if (!_context.SpecificNeeds.Any())
{
var parent = _context.SpecificNeeds.Add(new SpecificNeed("Child at risk")).Entity;
_context.SaveChanges(); // Exception here
Hi Alper, Those controllers are part of DLLs offered by DevExpress.
Regards Bilal
Hi Jehad,
It seems the Castle Windsor is not catching the DevExpress Controllers.
In the Startup\XXXWebMvcModule.cs, add the following and it should work smooth:
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(BarznWebWebMvcModule).GetAssembly());
IocManager.Register(typeof(WebDocumentViewerController), DependencyLifeStyle.Transient);
IocManager.Register(typeof(QueryBuilderController), DependencyLifeStyle.Transient);
IocManager.Register(typeof(ReportDesignerController), DependencyLifeStyle.Transient);
}