New Posts New Posts RSS Feed: Executing a query server side in a svc
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Executing a query server side in a svc

 Post Reply Post Reply
Author
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Topic: Executing a query server side in a svc
    Posted: 11-Oct-2012 at 11:18am
You should not use the DefaultEntityManager.
I am slightly confused by your code as the reference to DefaultEntityManager is commented out, so I actually assumed that the line:
 
manager = new DomainModel.Admin.MyAdminEntities(EntityManager.DefaultManager);
is active in your app. (i.e. not commented out)
 
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 10-Oct-2012 at 11:16pm
And so what should I use? there's no problem for me to login at the server side...
can you please provide me a sample?
 
Thanks
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 10-Oct-2012 at 10:11am
Hi Paolo,
 
The issue you are facing is due to the fact that the DefaultManager is static and should not be used across threads.
Also note that since you are using the EntityManager in a service you will need to log it in to perform queries. (i.e. unlike the EntityManager in the LoginManager, that is automatically logged in)
 
sbelini.
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 09-Oct-2012 at 6:55am
Hello,
I've got a svc service that I user for managing authentication stuff...when a User changes the password I should insert some data in 2 table...(I'm on the server side)

When I do


                my.DomainModel.Admin.TMRAdminEntities manager = new my.DomainModel.Admin.myAdminEntities();

//                manager = new DomainModel.Admin.MyAdminEntities(EntityManager.DefaultManager);

                var query = manager.aspnet_Users.Where(o1 => o1.UserName == username).Include("USER_ACCOUNT_EXPIRY");

I got :

EntityManager.DefaultManager is not available on the server because of threading and security concerns associated with static properties.

How can I use Ideablade on the server side?
Thanks
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down