New Posts New Posts RSS Feed: License key or compilation errors when using multiple models
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

License key or compilation errors when using multiple models

 Post Reply Post Reply
Author
mikewishart View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Feb-2010
Location: Reno, NV
Posts: 49
Post Options Post Options   Quote mikewishart Quote  Post ReplyReply Direct Link To This Post Topic: License key or compilation errors when using multiple models
    Posted: 09-Jul-2010 at 1:58pm
If you have a single EntityManager managing multiple edmx files, this gets a little more complicated.  There is no constructor or license information automatically generated in the generated Designer.cs code files.

We just got this to work:

* find or create a project with a single edmx file, then locate the Designer.cs file under the .tt file.  Grab the IBCore.IdeaBladeLicense and IbCore.IdeaBladeGuid lines out of this file.

* Create a new class file in your model right next to your edmx files.  This will be the constructor for your EntityManager.  see code below...

* Replace everything in red with the appropriate information (namespace, entitymanager class name, IdeaBladeLicense and IdeaBladeGuid).  Of course, the namespace must be the same across all your edmx files and this constructor class file.

Thanks to support for helping figure this one out!

-------------

using System;
using System.Reflection;
using IbCore = IdeaBlade.Core;
using IbEm = IdeaBlade.EntityModel;

[module: IbCore.IdeaBladeLicense("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")]

namespace DomainModel
{
  public partial class DomainModelEntityManager
  {
    #region Constructors

    /// <summary>See <see cref="M:IbEm.EntityManager.#ctor()"/>. </summary>
    public DomainModelEntityManager() : base() { }

    /// <summary>See <see cref="M:IbEm.EntityManager.#ctor(Boolean)"/>. </summary>
    public DomainModelEntityManager(Boolean shouldConnect) : base(shouldConnect) { }

    /// <summary>See <see cref="M:IbEm.EntityManager.#ctor(Boolean, String)"/>. </summary>
    public DomainModelEntityManager(Boolean shouldConnect, String dataSourceExtension) : base(shouldConnect, dataSourceExtension) { }

    /// <summary>See <see cref="M:IbEm.EntityManager.#ctor(Boolean, String, IbEm.EntityServiceOption)"/>. </summary>
    public DomainModelEntityManager(Boolean shouldConnect, String dataSourceExtension, IbEm.EntityServiceOption entityServiceOption) : base(shouldConnect, dataSourceExtension, entityServiceOption) { }

    /// <summary>See <see cref="M:IbEm.EntityManager.#ctor(IbEm.EntityManager)"/>. </summary>
    public DomainModelEntityManager(IbEm.EntityManager entityManager) : base(entityManager) { }

    /// <summary>See <see cref="M:IbEm.EntityManager.#ctor(IbEm.EntityManager, Boolean, String, IbEm.EntityServiceOption)"/>. </summary>
    public DomainModelEntityManager(IbEm.EntityManager entityManager, Boolean shouldConnect, String dataSourceExtension, IbEm.EntityServiceOption entityServiceOption) : base(entityManager, shouldConnect, dataSourceExtension, entityServiceOption) { }

    static DomainModelEntityManager()
    {
      IbEm.EntityRelation.InitializeEntityRelations(Assembly.GetExecutingAssembly());
    }

    #endregion Constructors

    #region DefaultManager

    /// <summary>Gets the default manager. </summary>
    public new static DomainModelEntityManager DefaultManager
    {
      get { return GetDefaultEntityManager<DomainModelEntityManager>(); }
    }

    #endregion DefaultManager
  }

  #region EntityRelations

  /// <summary>
  /// A generated class that returns the relations between entities in this model.
  /// </summary>
  [IbCore.IdeaBladeGuid("xxxxxxxxxxxxxxxxxxxxxxx")]
  public partial class EntityRelations
  {

    /// Explicit static constructor ensures static fields are initialized.
    static EntityRelations() { }
  }

  #endregion EntityRelations
}

Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 24-May-2010 at 6:23pm
We now have a patch for this.  See this thread:
 
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 07-May-2010 at 5:29pm
Quite a number of you are working with multiple EDMX models in the same solution.  This is a great DevForce feature, but we're still working out some kinks with the Visual Studio IDE.  The next release will be much improved in this regard.
 
In the meantime, if you are getting license violation or compilation errors this process may solve the issue:
  1. Make sure you have checked out the EDMX and Designer.cs for each model and that they are writable.
  2. Run the custom tool for each .tt (right click and select "RunCustom Tool") and save the changes.  Make sure to do this on the files with the .tt extension.
  3. It may help if you restart Visual Studio and try steps 1 and 2 again.

If you're still getting the license error, open the .Designer.cs files and copy the IBCore.IdeaBladeLicense and IbCore.IdeaBladeGuid attributes from one file to the other.

 


Edited by ting - 09-Jul-2010 at 12:43pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down