Last post Jan 29, 2019 11:26 AM by fatihbarut
Jan 28, 2019 11:21 AM|fatihbarut|LINK
Obviously I have problem with my DBcontext setup because when I try to get data from 2 different table with 2 different context via 2 in succession jquery $.get method I got the error
Message=An attempt was made to use the context while it is being configured. A DbContext instance cannot be used inside OnConfiguring since it is still being configured at this point. This can happen if a second operation is started on this context before a
previous operation completed. Any instance members are not guaranteed to be thread-safe.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
services.Add(new ServiceDescriptor(typeof(EvrakaContext), new EvrakaContext(Configuration.GetConnectionString("EvrakaContext"))));
neither of these ways are working
public List<string> TumIllerListesi()
EvrakaContext context = HttpContext.RequestServices.GetService(typeof(EvrakaContext)) as EvrakaContext;
return context.Set<Iller>().Select(u => u.Il).ToList();
private readonly EvrakaContext _context;
public NumuneKabulController(EvrakaContext context)
_context = context;
public IList<string> GonderenListesiYukle()
return _context.Set<Gonderenler>().Select(u => u.Gonderenmakam).ToList();
Jan 28, 2019 08:47 PM|DA924|LINK
I'll assume that this issue about the connectionstring has solved your problems that you addressed in the MVC forum?
Jan 29, 2019 11:26 AM|fatihbarut|LINK
Yes it seems so but couldn't be sure and wanted to be sure to get other ideas in here if exists.