troubleshooting Question

'System.Reflection.TargetInvocationException'

Avatar of omegalove
omegalove asked on
ASP.NET
2 Comments1 Solution622 ViewsLast Modified:
An exception of type 'System.Reflection.TargetInvocationException' occurred in System.Web.dll but was not handled in user code

Additional information: Exception has been thrown by the target of an invocation.

/// <summary>
    /// Creates a new instance of the OmegaLoveObjectContext class
    /// </summary>
    public OmegaLoveObjectContext()
        : this(ConfigurationManager.ConnectionStrings["omegaloveConnectionString"].ToString())
    {

    }

    /// <summary>
    /// Creates a new instance of the OmegaLoveObjectContext class
    /// </summary>
    /// <param name="connectionString">Connection String</param>
    public OmegaLoveObjectContext(string connectionString)
        : base(connectionString, "OmegaLoveEntities")
    {
        _entitySets = new Dictionary<Type, object>();
        this.ContextOptions.LazyLoadingEnabled = true;
    }
    #endregion


string connectionString = ObjectContextHelper.GetEntityConnectionString();

            T context = Activator.CreateInstance(typeof(T), new object[] { connectionString }) as T;
 ===> fails.
            return context;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros