New Posts New Posts RSS Feed: Error when deploying af Model containing associations
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Error when deploying af Model containing associations

 Post Reply Post Reply
Author
rasmus View Drop Down
Groupie
Groupie


Joined: 05-Aug-2009
Location: Denmark
Posts: 63
Post Options Post Options   Quote rasmus Quote  Post ReplyReply Direct Link To This Post Topic: Error when deploying af Model containing associations
    Posted: 25-Sep-2009 at 6:17am
Hi
 
I have a problem when deploying my small test-application.
 
I am in the final stages of approving your framework for production use, but when depolying to my test-server I get an error.
 
The application being deployed consists of:
 
A model containing 6 entities. When I deploy the application WITHOUT having any associations between the entities, everything works. But if I add an association between two of the entities (Customer and CustomerGroup), I get an error when logging in to the app:
 
Unable to login: Unable to locate navigation property: CustomerGroup
 
Looking in the log file, this is what I see:
 
2009-09-25 13:41:32 IdeaBlade.EntityModel.Edm EdmEntityInfo::BuildNavigationPropertyMap EntityRelation NextStay.Booking.DomainModel.FK_Entity_CustomerGroup not found
2009-09-25 13:41:32 IdeaBlade.EntityModel.Server EntityServerErrorHandler::CreateMessageFault Caught exception: LoginException: Unable to login: Unable to locate navigation property: CustomerGroup ---> at IdeaBlade.EntityModel.Server.SessionManager.GetPrincipal(ILoginCredential pCredential) at IdeaBlade.EntityModel.Server.SessionManager.Login(ILoginCredential pCredential) at IdeaBlade.EntityModel.Server.EntityServer.Login(ILoginCredential credential) at SyncInvokeLogin(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
 
I really enjoy using your framework, så I hope you can help me with this last obstacle :-)
 
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2009 at 9:53am
Check that the assembly containing the Entity Model is also deployed, and that it's in sync with the Domain Model.  There's no reason that a model would work w/o associations and fail with them in place, so it's likely that the two models are no longer in sync.
Back to Top
rasmus View Drop Down
Groupie
Groupie


Joined: 05-Aug-2009
Location: Denmark
Posts: 63
Post Options Post Options   Quote rasmus Quote  Post ReplyReply Direct Link To This Post Posted: 26-Sep-2009 at 9:18am
Hi
 
I have checked the assmblies and they are all of the correct version - 5.2.2.0, including the assembly containing the entity model.
 
I have narrowed down the issue a bit: in my setup I have multiple sites (all identical and referencing the same assemblies). The error appears after accessing all sites after the first one. F.x.:
 
I reset the IIS
I access site1 - everyting is fine
I access site2 - i get the above mentioned error
 
And from every site thereafter, I get an error. If I reset the IIS and select a random site, then first site is ok, but accessing other sites results in error.
 
Could this be caused by some limitation when running the Express edition?
 
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 28-Sep-2009 at 2:03pm
The only limitation with DevForce Silverlight Express is the 10 entity restriction.  It doesn't sound like that's causing your problem.
 
What does your IEntityLoginManager implementation look like?  Can you post it here (or email to us if not)?
Back to Top
rasmus View Drop Down
Groupie
Groupie


Joined: 05-Aug-2009
Location: Denmark
Posts: 63
Post Options Post Options   Quote rasmus Quote  Post ReplyReply Direct Link To This Post Posted: 29-Sep-2009 at 4:39am

Hi
 
Here is the implementation of my LoginManager:
 
 
public class LoginManager : IEntityLoginManager

{

public IPrincipal Login(ILoginCredential credential, EntityManager entityManager)

{

// Disallow null credentials and throw a LoginException

if (credential == null)

{

throw new LoginException(LoginExceptionType.NoCredentials, "Loginoplysninger mangler");

}

//return error if loginmanager i null

if (entityManager == null)

throw new LoginException(LoginExceptionType.NoLoginManager, "Loginmanager findes ikke.");

var user = entityManager.GetQuery<User>().FirstOrDefault(u => u.Id == credential.UserName);

//user does not exist

if (user == null)

throw new LoginException(LoginExceptionType.InvalidUserName, "Bruger '" + credential.UserName + "' findes ikke.");

//wrong password

if (user.Password != credential.Password)

throw new LoginException(LoginExceptionType.InvalidPassword, "Forkert password.");

// types implementing IPrincipal.

GenericIdentity identity = new GenericIdentity(credential.UserName);

GenericPrincipal principal = new GenericPrincipal(identity, new string[] { });

return principal;

}

public void Logout(IPrincipal principal, EntityManager entityManager)

{

// No special processing needed.

}

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 29-Sep-2009 at 10:16am
rasmus, sorry for all the questions but other than the domain and entity models being out-of-sync there seems no reasonable explanation for the problem.  I wanted to see your LoginManager to see if anything "unusual" was going on there, but it looks fine.
 
The message "EntityRelation 'NextStay.Booking.DomainModel.FK_Entity_CustomerGroup' not found", which precedes the exception, is interesting.  Is "NextStay.Booking.DomainModel" the same namespace in which your EntityRelations class is defined?   The Object Mapper auto-generates the EntityRelations class into the same namespace as the entities and EntityManager of your domain model.  Each EntityRelation field in this class is named after a corresponding association in the EDMX conceptual model.  
 
How did you add the association between Customer and CustomerGroup?  Is FK_Entity_CustomerGroup also defined in the database and the Entity Model?
Back to Top
rasmus View Drop Down
Groupie
Groupie


Joined: 05-Aug-2009
Location: Denmark
Posts: 63
Post Options Post Options   Quote rasmus Quote  Post ReplyReply Direct Link To This Post Posted: 30-Sep-2009 at 3:23am
I do not mind all the questions, just happy you are trying to help!
 
All my classes including the EntityRelations class is defined in the same namespace: NextStay.Booking.DomainModel. I added the relation by creating a foreign key in the database, and updating the edmx-model (right-click and selecting update model). I have checked the xml-mappings in the edmx file and they look fine.
 
The assemblies being deployed are all deployed to the GAC on the server:
 
All IdeaBlade assemblies are deployed to GAC
My assemblies: NextStay.Booking.dll + NextStay.Booking.ModelDF.dll + NextStay.Booking.ModelEF.dll are deployed to the GAC (they are all signed, and so is the "main" assembly deployed to the SL-client)
 
Using this setup I get the aforementioned error - not when loggin in on the first site, but when loggin in to site2, site3 etc.
 
But I have discovered this:
 
If I move the 3 assemblies (NextStay.Booking.dll + NextStay.Booking.ModelDF.dll + NextStay.Booking.ModelEF.dll ) from the GAC, and instead deploy them to the bin folders of the respective sites, I no longer get the error.
 
Does this make any sense?
 
 
 
Back to Top
rasmus View Drop Down
Groupie
Groupie


Joined: 05-Aug-2009
Location: Denmark
Posts: 63
Post Options Post Options   Quote rasmus Quote  Post ReplyReply Direct Link To This Post Posted: 01-Oct-2009 at 4:28pm
Hi
 
Can anybody help me on this, I am stuck. Any help would be appreciated.
 
Or am I wrong on this? should it not be possible to deploy a model having associations to the GAC, and have different websites referencing the same assemblies?
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 01-Oct-2009 at 7:40pm
Deploying to the GAC is a problem, since several assemblies are expected to be found in the bin folder -- these include IdeaBlade.EntityModel.Server, which is used by the .svc files; the domain model assembly and the entity model assembly. 
 
I was able to reproduce your problem, but only by dropping an assembly into the bin folder while an SL application window was open and already connected and logged in, and the error occurred during a fetch.  Possibly something is causing the application to recompile to cause the problem you're seeing.  DevForce will retry after a connection failure, which is the error expected when the server recompiles, but since your problem is in your LoginManager I'm not really sure what in your configuration is causing the problem.  If placing assemblies in the bin folder solves your problems, then I guess we should assume for now that you should not use the GAC, or only selectively deploy to the GAC.  If you find a solution, please post it to the forum to share with the community.
 
 
Back to Top
rasmus View Drop Down
Groupie
Groupie


Joined: 05-Aug-2009
Location: Denmark
Posts: 63
Post Options Post Options   Quote rasmus Quote  Post ReplyReply Direct Link To This Post Posted: 02-Oct-2009 at 1:42am

Thank you for taking your time to repro the problem and look into the problem. Unfortunately it is not an option for us to deploy to each bin folder since:

1. We would have to deploy to 100+ folders (each of our customers have their own site). This could be automized, but also
2. I was under the impression that deploying the assemblies to the GAC would allow the server to "share" resources for the assemblies; instead of having the same assembly loaded 100 times, it would only be loaded 1 time (please correct me on this matter if I am wrong.)
 
For now I think I will skip the loginmanager, since this seems to eliminate the error. I know I am asking a lot, but would it be possible to have you look into this matter, as I have spent 4 days trying to get around it with no luck, and it is of great value to us that we can deploy assemblies like we have done before using the DevForce framework?
 
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 05-Oct-2009 at 6:48pm
Since we weren't able to exactly reproduce the problem you see, it would help if you could provide a sample which exhibits the problem, including information on what you're installing to the GAC, config files, IIS settings, and anything else you think is pertinent.  You can send it to IdeaBladeSupportTrack@IdeaBlade.com.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down