473,473 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Difficulty in Loading the type from the referenced assembly

308 Contributor
Hi All,

I am facing a problem while loading the type from the referenced assembly.

I am implementing the Dependency Injection Design Pattern in the application. Here is the code
1) I have the ITest.cs - ITest<T>
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.     interface ITest<T> 
  4.     {        
  5.         //CRUD
  6.         void Create();
  7.         void Insert(T t);
  8.         void Update(T t);
  9.         void Delete(T t);
  10.         void Save();
  11.     }
  12.  
2) A Container to create the ITest reference. The container holds a static method that returns ITest<T>

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  public class Repository
  4.     {
  5.         public static ITest<T> GetInterfaceRepository<T>(string dll,string type)
  6.         {
  7.             try 
  8.             {
  9.                 var i = Activator.CreateInstance(dll, type) as ObjectHandle; 
  10.  
  11. //Here it is Giving an error as 
  12. //Could not load type 'ClassTest' from assembly 'Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
  13.  
  14.                 var retval = i.Unwrap() as ITest<T>; return retval; 
  15.             }
  16.             catch (Exception E) 
  17.             { 
  18.                throw E;
  19.             }
  20.         }
  21.     }
  22.  
3) The consumer is as -

Expand|Select|Wrap|Line Numbers
  1.  
  2. ITest<ClassTest> iRepos = Repository.GetInterfaceRepository<ClassTest>("dllPathFor_ClassTest", "ClassTest");
  3.  
  4. iRepos.Create();
  5.  
Test.dll is the assembly getting referenced and pertains the type ClassTest.

Please guide if anybody have suggestion on.
May 28 '12 #1
0 1615

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: piyushc | last post by:
Hi, I am having problem creating new project using VS.Net 2003. Whenever I am trying to create new project (any type) it shows error message "Error writing the project file. Error loading...
0
by: Erwan | last post by:
I have a strange (but very blocking) result when using the smtpmail class from an ASPX page : here is the (very simple !) code... '-------------------------------------------------- mail.To =...
0
by: Eric van Wijk | last post by:
Hi All, After installing SP1 for Windows 2003, I'm running into the 'Error loading type library/DLL' exception when using CDO through System.Web.Mail: ...
0
by: Michel Gallant | last post by:
I have a simple asp.net page, NET 1.1, and no web.config file. I place the main assembly source in following directory: C:\Inetpub\wwwroot\cryptonet I link in a referenced COM interop assembly...
4
by: mct | last post by:
Environment --------------- Visual Studio 2005 ..NET 2.0 Windows XP SP2 Scenario ---------- TCLibrary (Class Library) • Contains MyIdentity and MyPrincipal classes that implement the...
0
by: eheinsen | last post by:
I've converted a multi-project application from VS2003 to VS2005. The solution has a WinForm project and a WebForm project. Both projects reference SQL Server Reporting Services (SSRS). The Winform...
1
by: ShrimpBoy | last post by:
Hi! I'm using a Strong Name Key to create our assemblies, this key has the Full Trust security so we can use those "mini tools" from network drives... I'm trying to use WMI to get access to...
2
by: drew.ferraro | last post by:
Hi, I am trying to build a .DLL file that uses "'Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces'". I am trying to build this .DLL as fully signed. However, when I try to build, I...
2
by: john | last post by:
Hi to All, Our all data source object are defined in a separate assembly than UI. When I start designing a new Crystal Report a dialog pops up and asks for data source. Unfortunately it lists...
1
by: madushan | last post by:
hi all, once i try to generate .cs file by using the aximp.exe tool it gives the error the command I used: C:\Documents and Settings\malik\Desktop\tt>aximp SHDocVw.dll...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.