asynchronous requests
See original GitHub issueGood morning,
this is my Repository:
`[Transaction(ReadOnly = true)] public abstract class EntityRepository<T, K> : IEntityRepository<T, K> where T : Entity<K> { [Autowired] public ISessionFactory SessionFactory { protected get; set; }
protected ISession CurrentSession
{
get
{
return SessionFactory.GetCurrentSession();
}
}
public FlushMode FlushMode
{
get
{
return CurrentSession.FlushMode;
}
set
{
CurrentSession.FlushMode = value;
}
}
public K Save(T entity)
{
return (K)CurrentSession.Save(entity);
}
public async Task<K> SaveAsync(T entity)
{
return (K)await CurrentSession.SaveAsync(entity);
}
public void Save(IEnumerable<T> entities)
{
foreach (T entity in entities)
{
CurrentSession.Save(entity);
}
}
public T Get(K id)
{
return CurrentSession.Get<T>(id);
}
public async Task<T> GetAsync(K id)
{
using (var session = SessionFactory.OpenSession())
{
return await session.GetAsync<T>(id);
}
}
public IQueryable<T> GetAllQueryable()
{
return CurrentSession.Query<T>();
}`
and to make asynchronous requests I have to create a new session:
using (var session = SessionFactory.OpenSession()) { return await session.GetAsync<T>(id); }
@lahma how can I configure nhibernate and spring to use the current session in asynchronous requests?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
Synchronous and asynchronous requests - Web APIs | MDN
Asynchronous request. If you use an asynchronous XMLHttpRequest , you receive a callback when the data has been received. This lets the browser ......
Read more >webserver - What is the difference between asynchronous ...
Asynchronous communication is when there could be multiple requests and responses could return in random order. – Logman. May 31, 2017 at 11:36....
Read more >Difference between synchronous and asynchronous ...
Asynchronous Request : The Asynchronous request will not prevent the DOM or browser from executing additional code until the server responds. The ...
Read more >Asynchronous Requests
Asynchronous request processing lets applications exit the Filter-Servlet chain but leave the response open for further processing. The Spring MVC ...
Read more >How to Make 2500 HTTP Requests in 2 Seconds with Async ...
This is a comparison about how to use Async and Asynio with AIOHttp and Python vs using threads and concurrent futures to best...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I personally would be more than willing to review a pull request for that 😉
I’m doing a rude experiment with closing this, like what stale bot does, but maybe more human as I will probably actually react to feedback. As this issue has been stale for so long, I’ll close it. If it’s still an issue you would like to pursue, we can definitely reopen.
With limited resources this is just something that we need to do. Thank you for your understanding.