Ok, let's try this again.
I have an ASP.NET 1.1 application that I'm working to convert to 2.0,
but I've run into a snag.
The problem is with this line:
return
(IDataProviderB ase)(((Construc torInfo)cache["IDataProviderB ase"]).Invoke(null)
);
This is supposed to create an object that uses the IDataProviderBa se
interface. The cache contents are created here:
cache.Insert( "IDataProviderB ase", Assembly.LoadFr om(
assemblyPath).G etType( className ).GetConstructo r(new Type[0]), new
CacheDependency ( assemblyPath ) );
className is a string from Web.Config with the fully qualified class
name ("AppName.Compo nents.DataAcces s.SQLDataAccess ", for example).
So, the constructor is stored in the cache, and is invoked when the
first bit of code is executed. Problem is, I'm getting an
InvalidCastExce ption there, and I have no idea why. I've tried casting
to the object being created with the same result. (Unable to cast
object of type 'AppName.Compon ents.DataAccess .SqlDataProvide r' to type
'AppName.Compon ents.DataAccess .SqlDataProvide r') I was able to assign
it to an Object object, and doing a GetType returns what I expected,
but I still can't cast it to the appropriate object.
So, any idea why this is happening? 2 1428
ASP.NET 1.1 to 2.0 I do hit a lot of tiny problems too. Are you converting
your 1.1 to 2.0 using VS 2005? If not then please do so. If you are doing
manual converting then ...
chanmm
"TheLongsho t" <Th*********@gm ail.comwrote in message
news:11******** **************@ h54g2000cwb.goo glegroups.com.. .
Ok, let's try this again.
I have an ASP.NET 1.1 application that I'm working to convert to 2.0,
but I've run into a snag.
The problem is with this line:
return
(IDataProviderB ase)(((Construc torInfo)cache["IDataProviderB ase"]).Invoke(null)
);
This is supposed to create an object that uses the IDataProviderBa se
interface. The cache contents are created here:
cache.Insert( "IDataProviderB ase", Assembly.LoadFr om(
assemblyPath).G etType( className ).GetConstructo r(new Type[0]), new
CacheDependency ( assemblyPath ) );
className is a string from Web.Config with the fully qualified class
name ("AppName.Compo nents.DataAcces s.SQLDataAccess ", for example).
So, the constructor is stored in the cache, and is invoked when the
first bit of code is executed. Problem is, I'm getting an
InvalidCastExce ption there, and I have no idea why. I've tried casting
to the object being created with the same result. (Unable to cast
object of type 'AppName.Compon ents.DataAccess .SqlDataProvide r' to type
'AppName.Compon ents.DataAccess .SqlDataProvide r') I was able to assign
it to an Object object, and doing a GetType returns what I expected,
but I still can't cast it to the appropriate object.
So, any idea why this is happening?
Yes, I'm using VS 2005. I'm still having problems. Any suggestions?
Jason
chanmm wrote:
ASP.NET 1.1 to 2.0 I do hit a lot of tiny problems too. Are you converting
your 1.1 to 2.0 using VS 2005? If not then please do so. If you are doing
manual converting then ...
chanmm
"TheLongsho t" <Th*********@gm ail.comwrote in message
news:11******** **************@ h54g2000cwb.goo glegroups.com.. .
Ok, let's try this again.
I have an ASP.NET 1.1 application that I'm working to convert to 2.0,
but I've run into a snag.
The problem is with this line:
return
(IDataProviderB ase)(((Construc torInfo)cache["IDataProviderB ase"]).Invoke(null)
);
This is supposed to create an object that uses the IDataProviderBa se
interface. The cache contents are created here:
cache.Insert( "IDataProviderB ase", Assembly.LoadFr om(
assemblyPath).G etType( className ).GetConstructo r(new Type[0]), new
CacheDependency ( assemblyPath ) );
className is a string from Web.Config with the fully qualified class
name ("AppName.Compo nents.DataAcces s.SQLDataAccess ", for example).
So, the constructor is stored in the cache, and is invoked when the
first bit of code is executed. Problem is, I'm getting an
InvalidCastExce ption there, and I have no idea why. I've tried casting
to the object being created with the same result. (Unable to cast
object of type 'AppName.Compon ents.DataAccess .SqlDataProvide r' to type
'AppName.Compon ents.DataAccess .SqlDataProvide r') I was able to assign
it to an Object object, and doing a GetType returns what I expected,
but I still can't cast it to the appropriate object.
So, any idea why this is happening?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: A. Wiebenga |
last post by:
Hi all!
I am a student at the Hogeschool van Arnhem en Nijmegen in Holland. I
am currently involved in a research project regarding Reflection.
Purpose of the research project is to document what Reflection is (I
can answer this question myself), what kind of Reflection Techniques
there are (.NET Reflection, Python Reflection etc. I can answer this
one myself too). The main question I need to answer is related to the
implementation of...
|
by: Sunny |
last post by:
Hi,
I have an old problem which I couldn't solve so far. Now I have found a post
in that group that gave me an idea, but I can not fully understand it.
The problem is: I'm trying to use a Windows.Forms.UserControl in a COM
environment, i.e. I want to host that control in a COM host. So far, so
good, I can host it, but I can not reach the parent COM object from the
control (Parent property is null :( ).
I have stopped the control in the...
|
by: Antony |
last post by:
Hello - I am wanting to print out a "Yes" next to classes that
implement "Interface01", otherwise a "No". Here is my code. It crashes
with a null reference exception and I am not sure why. Ideas?
Thank you for you help.
Tony
Imports System.Reflection
Public Class Form1
|
by: Bob |
last post by:
If you rename a type at design time, the the task list shows what code broke,
which happens to be a very nice list of dependant classes and methods. Is there
any way to produce such dependency information at runtime?
Bob
|
by: Shawn Hogan |
last post by:
Hi everyone,
I've been trying to execute a control's private event code via reflection
from another class with the goal of potentially doing some unit testing. The
examples below are trying to execute button2's click event.
This works great when i know the name of the method that i want to invoke. I
do so by doing this:
Dim AssemblyPointer As Reflection.Assembly
| |
by: Nemisis |
last post by:
Hi everyone,
Can anyone tell me if it is possible to pass in a property of an object
into a sub, and within that sub, find out the name of the item that was
passed along with the property name??
Example would be
......Code
Dim ObjA As New ObjectA
|
by: |
last post by:
I am having problems with casting or converting a class to to an interface
from which it derives. I'm certain that it's due to how it's being loaded,
but I'm not sure how to get past the problem.
Here's a general outline of the architecture. It's oversimplified, but I
think it's enough info to help:
Assembly A.dll
{
interface IMyBase {}
|
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= |
last post by:
Hi
I am slightly familiar with reflection but have never done the following
I know how to find a class and call but I haven't done the following
The Method return a List of Another Class
And I need to pass in an Enumeration which is in the class that contains the
method below
1)How do I create a List of this Class thru Reflection and once i populate it
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |