Thanks for replying David.

These are the DLLs that I imported. The application runs fine on my
local machine, the error is only happening when the trust="medium" aka
a medium trust environment.

Here are the DLL's my application is seeing:
DbLinq.dll
DbLinq.MySql.dll
MySql.Data.dll

I'm getting the following error message:
{"Type 'DbLinq.Data.Linq.Sugar.IDataMapper' has no implementation"}
 at DbLinq.Factory.Implementation.ReflectionObjectFactory.Create(Type
t)
   at DbLinq.Factory.Implementation.ReflectionObjectFactory.Get(Type
t)
   at DbLinq.Factory.ObjectFactoryExtensions.Get[T](IObjectFactory
self)
   at DbLinq.Factory.ObjectFactory.Get[T]()
   at DbLinq.Data.Linq.DataContext..ctor(IDatabaseContext
databaseContext, MappingSource mappingSource, IVendor vendor)
   at DbLinq.Data.Linq.DataContext..ctor(IDatabaseContext
databaseContext, IVendor vendor)
   at DbLinq.Data.Linq.DataContext..ctor(IDbConnection dbConnection,
IVendor vendor)
   at AppUI.Models.Linq.MySqlDBTest..ctor(IDbConnection connection)
   at AppUI.Controllers.AccountController.ValidateLogOn(String
userName, String password)

I am trying to edit the ReflectionObjectFactory's Create(Type t)
method to somehow anticipate this error and deal with it accordingly,
but I don't fully know what the create method is trying to accomplish.
Here is the code modification that I am attempting:

 public object Create(Type t)
        {
            //warning - the Activator.CreateInstance below was
throwing unerported exceptions (as of 2008June).
            //So - let's add two future rules:
            //1) for know types from DbLinq, don't load via Activator.
            //2) surround all Activator calls with try/catch block.
            if (t.IsInterface)
            {
                IList<Type> types;
                try
                {
                    if (!Implementations.TryGetValue(t, out types))
                        throw new
ArgumentException(string.Format("Type '{0}' has no implementation",
t));
                    if (types.Count > 1)
                        throw new
ArgumentException(string.Format("Type '{0}' has too many
implementations", t));
                    return Activator.CreateInstance(types[0]);
                }
                catch (ArgumentException ex)
                {
                    if (ex.Message.Contains(" {\"Type
'DbLinq.Data.Linq.Sugar.IDataMapper' has no implementation\"}"))
                    {
                        //DbLinq.Data.Linq.Sugar.IDataMapper idm;
 
DbLinq.Data.Linq.Sugar.Implementation.DataMapper idm = new
DbLinq.Data.Linq.Sugar.Implementation.DataMapper();
                        return
(DbLinq.Data.Linq.Sugar.IDataMapper)null;
                    }
                }
            }

               return Activator.CreateInstance(t);


        }

On Jul 15, 4:04 am, David Gould <[email protected]> wrote:
> On 15/07/2010 00:51, N!cky wrote:> Have you found the solution to this 
> problem? I just recently
> > encountered it and haven't found a solution.
>
> Simple question:
>
> Are all the DLLs present which you need?  Can the runtime "see" them?
>
> Thanks,
>
> David.

-- 
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en.

Reply via email to