New Posts New Posts RSS Feed: can't find compositionContext
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

can't find compositionContext

 Post Reply Post Reply
Author
jhoward View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jun-2011
Location: SoCal
Posts: 5
Post Options Post Options   Quote jhoward Quote  Post ReplyReply Direct Link To This Post Topic: can't find compositionContext
    Posted: 07-Jun-2011 at 7:23am
Thanks for your time. This problem is solved.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2011 at 7:22pm
Thanks for the feedback regarding the documentation. You're right that it is not properly documented. We will update it accordingly.

Currently, apart from the "+" char, any character is safe as long as it's valid for a file name.
Back to Top
jhoward View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jun-2011
Location: SoCal
Posts: 5
Post Options Post Options   Quote jhoward Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2011 at 6:04pm
I should have mentioned that the problem only occurs in n-tier. Sorry. It would have been helpful if I mentioned that the CompositionContext name should have been "Dmr" and the keyExtention, "RBV644+FIN". I'll try to enter a more thorough description in the future. :-)
It turns out that both "_" and "-" can occur in the two parts that are joined to make the DataSourceExtension so those are not good choices. I've given my testers a version that uses "|" to try out. It would be nice if there were something in the documentation that listed reserved characters. It's not in the API documentation for that constructor overload for EntityManager.
Is there somewhere I can find a list of safe characters (other than the two you've suggested)? Trial and error will work here but I don't want to pick something that IdeaBlade is going to scarf up later if I can help it. And I'd like to avoid the complication of double escaping.
Here's the entity manager constructor call you asked for earlier:
var entityManager = new GemModel(
true,
IafMgr.ThreadEnvironment.Environment + "|" + this.DatabaseId,
compositionContextName:GemModel.DmrCompositionContextName);
In the above the value of IafMgr.ThreadEnvironment.Environment is "Rbv644", this.DbatabaseId is "FIN", and DmrCompositionContextName is "Dmr".
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2011 at 5:41pm
Hi jhoward;

I was looking at this again, and was able to get the same exception in n-tier. You're correct, it is caused by the "+" char because we use that character to delimit the composition context name. I would suggest using "_" or "-" for your purposes. And depending on your environment, you may have to set "allowDoubleEscaping" to true in your web.config.


Sorry for the confustion.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2011 at 1:03pm
Hi jhoward;

I was not able to repro your issue here in 6.1.0. I'm using the "+" character in both my custom CompositionContext name as well as my DataSourceExtension and I didn't have the exception thrown.

In my testing, I have the following debug log entry:

EntityServer created for DataSourceExtension: Customer01+XXX, CompositionContext: Admin+XXX

And I have the following custom CompositionContextResolver and CustomDataSourceKeyResolver:

namespace Server {
  public class CompositionContextResolver : BaseCompositionContextResolver {
    public static CompositionContext Admin = CompositionContext.Default
      .WithGenerator(typeof(CustomDataSourceKeyResolver))
      .WithName("Admin+XXX");
  }

  class CustomDataSourceKeyResolver : IDataSourceKeyResolver {

      public IDataSourceKey GetKey(string keyName, string keyExtension, bool onServer) {
         //Unnecessary details omitted
     }
  }

}

And I create an EntityManager as follows:

var entityManager = new DomainModelEntityManager(
        shouldConnect: true, 
        dataSourceExtension: "Customer01+XXX", 
        compositionContextName: CompositionContextResolver.Admin.Name);

EntityServer created for DataSourceExtension: RBV644, CompositionContext: FIN+Dmr

Could you clarify that FIN+Dmr is what you want for your keyExtension? Judging from the entry above, it sounds like you have RBV644 configured for your keyExtension, and FIN+Dmr for your custom CompositionContext name. Do you have a custom implementation of ICompositionContextResolver? If possible, I'd also like to see the whole debug log and your implementation of GetKey().
Back to Top
jhoward View Drop Down
Newbie
Newbie
Avatar

Joined: 06-Jun-2011
Location: SoCal
Posts: 5
Post Options Post Options   Quote jhoward Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2011 at 5:11am
Our application has implements IDataSourceGetKey.Get() and depends on a keyExtension with two parts concatenated together to give us what we need to resolve the data source key. We chose "+" as the separator for the two parts. Since upgrading to 6.1.0, we get the following exception:
IdeaBlade.Core.IdeaBladeException: Unable to find a compositionContext with the name: FIN+Dmr
The exception immediately follows this entry in the debug log:
EntityServer created for DataSourceExtension: RBV644, CompositionContext: FIN+Dmr
Our testers believe this has something to do with the "+" character in the name in the composition context. Does that seem plausable? If so, how can we know what characters are safe to use for our purpose?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down