WorkingDirectory
confirmed.
@ismcagdas,
I'm not confident that converting my app from EF to SQL would be effective. it's a lot of code that would need to be changed, and I'm concerned that SQL updates will not effect until transaction/thread completion after all the changes.
I'm using EF in ASP.NET Framework 4.5.2 in my original app; excellent performance and the db is updated upon context.SaveChanges()
.
EF in Zero/Core however has slower performance and the db is NOT updated upon context.SaveChanges()
; the db is updated upon transaction/thread completion.
I think the mystery now is why non-transactional unit of work attributes (as recommended by @maliming) are not working.
I implemented the suggested code changes. Records are not committed to the physical db and performance is 3X SLOWER than the same code in ASP.NET.
Is there anything I might have missed that would be preventing commit or result in degraded performance?
using System;
using System.Collections.Generic;
using System.Linq;
#if NETFRAMEWORK
using DataModelLibrary.Exams;
using DbContext = DataModelLibrary.Exams.DbContext_Exam;
#endif
#if NETCOREAPP // https://docs.microsoft.com/en-us/dotnet/standard/frameworks
using Abp.Domain.Uow;
using Abp.EntityFrameworkCore;
using System.Transactions;
using ngTTM.TtmDataModel;
using DbContext = ngTTM.EntityFrameworkCore.ngTTMDbContext;
#endif
// for clarity, all NETFRAMEWORK-specific code has been removed
namespace JobsLibrary
{
public class CreateExamsDemo
{
//-----------------------------------------------------------------------------------------
private readonly IDbContextProvider<DbContext> _dbContextProvider;
//-----------------------------------------------------------------------------------------
public CreateExamsDemo(IDbContextProvider<DbContext> dbContextProvider)
{
_dbContextProvider = dbContextProvider;
}
//-----------------------------------------------------------------------------------------
[UnitOfWork(IsDisabled = true)]
// [UnitOfWork(isTransactional: false)]
public bool Create(string guid, string rootFolder)
{
DateTime _StartTime = DateTime.Now;
try
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Suppress))
{
DbContext context = _dbContextProvider.GetDbContext();
{
Exam exam = context.Exams.First(x => x.Guid == guid);
// not shown are calls to other functions accessing many db tables
// the code fragment below illustrates the concept
List<ExamQuestion> examQuestionsList = new List<ExamQuestion>();
// add multiple ExamQuestion to list
context.ExamQuestions.AddRange(examQuestionsList);
// acquire table "id" values used in next processing steps (not shown)
context.SaveChanges();
// typical execution time in NETFRAMEWORK is approx. 4 minutes
// typical execution time in NETCOREAPP is approx. 16 minutes
exam.CreateDuration = (float)(DateTime.Now - _StartTime).TotalSeconds;
context.SaveChanges();
return true;
}
}
}
catch (Exception ex)
{
// Exception handler
return false;
}
//-----------------------------------------------------------------------------------------
}
}
}
Where does this function reside? How and when is it invoked? The Abp documentation page does not answer these questions.
My app is Angular/Core ANZ v 7.0.0. Change Log ANZ 7.1.0 mentions "Enable in-process hosting model". Where can I read about this feature and how to use it in ANZ?
Why is it not a good practice? How is a legacy Console app that was created outside the Abp/Zero universe executed?
Is there any interface available in Abp/Zero (Angular/Core) that will allow
context.SaveChanges();
to be immediately written to the database, and NOT wait until the thread is exited?
Using UnitOfWork is not an option, as that introduces its own overhead.
I'm seeking a high-performance solution to write one row at a time to my Apb/Zero db.
I have a Console Application that was created independently of Abp/Zero. How can I launch that Process from within my Zero app? I tried the following code, but the Console app is not Executed.
System.Diagnostics.Process examCreateProcess = new System.Diagnostics.Process();
examCreateProcess.StartInfo.WorkingDirectory = workingDirectory;
examCreateProcess.StartInfo.FileName = "MyConsoleApp.exe";
examCreateProcess.StartInfo.Arguments = operation + " " + userId + " " + rootfolder;
examCreateProcess.Start();
I want to fork a long-running db intensive process to a new Process. The Process ...
Can you direct me to some documentation and sample code on how to accomplish this?
Thank you.
Created a project based on Zero's Demo project.
Unable to reproduce the error
Exception: Unable to determine the relationship represented by navigation property 'User.DeleterUser' of type 'User'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
in the Demo project due, I suspect, to the specific table/foreign key relationships in my db, which I would be impractical to reproduce in a demo project.
I will submit a new issue that I need to resolve that may reveal a solution to this issue.