Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> LLBLGen Pro v2.6 on Windows Server 2012 R2 on AWS
 

Pages: 1
LLBLGen Pro Runtime Framework
LLBLGen Pro v2.6 on Windows Server 2012 R2 on AWS
Page:1/1 

  Print all messages in this thread  
Poster Message
Priyank Rana
User



Location:

Joined on:
10-Oct-2019 12:12:50
Posted:
5 posts
# Posted on: 10-Oct-2019 12:25:36.  
We are in process of migrated one of our websites from on premise Windows Server 2008 to AWS Windows 2012 R2. However it's throwing an exception when we are invoking method FetchEntity(). Not sure if it is a compatibility issue or access problem on the new environment. Can you please advise?
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37645 posts
# Posted on: 10-Oct-2019 14:44:00.  
" However it's throwing an exception "
Without knowing what kind of expression and a stacktrace it's hard to tell what it is...


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Priyank Rana
User



Location:

Joined on:
10-Oct-2019 12:12:50
Posted:
5 posts
# Posted on: 11-Oct-2019 10:15:15.  
Below expression is not evaluating and giving no output

GetAdapter().FetchEntity(user)

Where

"user" is login user name and

protected DataAccessAdapter GetAdapter()
        {
            DataAccessAdapter adapter = new DataAccessAdapter(this._connectionString);
            adapter.CatalogNameUsageSetting = SD.LLBLGen.Pro.ORMSupportClasses.CatalogNameUsage.ForceName;
            adapter.CatalogNameToUse = this._catalogName;
            return adapter;
        }

Hope above information helps, please let me know if I can provide more details.
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 11-Oct-2019 10:49:50.  
Sorry, we need the exception text, and the stack trace.

  Top
Priyank Rana
User



Location:

Joined on:
10-Oct-2019 12:12:50
Posted:
5 posts
# Posted on: 15-Oct-2019 09:48:55.  
Error is: "The entity is out of sync with its data in the database. Refetch this entity before using this in-memory instance."

Stack Trace:

at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.GetValue(Int32 fieldIndex, Boolean returnDefaultIfNull)
at CAG.REG.Security.LLBLGen.EntityClasses.SecurityUserEntity.get_IsActive()
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 15-Oct-2019 22:01:43.  
The stack trace is not complete, but anyway, I guess you are trying to access a property of the user entity (IsActive), while the entity seems out of Sync with the database.

So I think upon login, you fetch the entity, modify some fields, for example "last login date", then you save the entity, and immediately afterwards you are accessing the IsActive property.

When you save an entity to the database, please make sure you re-fetch it, to make sure all field values are in sync with the database.

To re-fetch upon save, you should find an overload of the SaveEntity() method which accepts a Boolean refetch parameter.


  Top
Priyank Rana
User



Location:

Joined on:
10-Oct-2019 12:12:50
Posted:
5 posts
# Posted on: 23-Oct-2019 17:35:17.  
Thanks Walaa for your response. I would like to confirm that we are not saving the entity at the time of login. How can I re-fetch without saving an entity?
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 24-Oct-2019 02:29:04.  
Same way you fetched the entity in the first place.

  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37645 posts
# Posted on: 24-Oct-2019 11:16:39.  
That or mark the entity as 'fetched':
myCustomer.Fields.State = EntityState.Fetched;

however this exception stems from the fact you have either a new entity instance (which fields have no meaning, so check the IsNew property!) or you have saved an entity and read the fields afterwards.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Priyank Rana
User



Location:

Joined on:
10-Oct-2019 12:12:50
Posted:
5 posts
# Posted on: 24-Oct-2019 11:27:04.  
Hi Otis,

Please have a look into my code below which is throwing outofsync exception. As you can see I am already marking State as Fetched, but still having issues.

public bool IsEnabled(string networkLogin)
        {
            SecurityUserEntity user = new SecurityUserEntity(base._applicationName, base._environmentName, networkLogin);
            user.Fields.State = EntityState.Fetched;
            
            if (GetAdapter().FetchEntity(user))
                
                return user.UserIsEnabled;
                
            else
                throw new Exception("User <" + networkLogin + "> does not have access to this application <" + _applicationName + "> <" + _environmentName + ">");
        }


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 24-Oct-2019 17:33:20.  
Can you please post the complete stack trace and line of code where the exception is raised?
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.