473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problems with Reflection please help

Hi,

im currently working on making myself a MySql Object Abstraction Layer

so that i pass in objects and it does the database trasnsactions using
reflection
so far everything works except the select

since im trying to rebuild the objects in my method based on an object
i pass in
i am no able to instantiate the object and to give it its constructor
args or to set its properties

i have pasted my code here :
http://www.vkarlsen.no/pastebin/ViewPaste.aspx?id=5452

the code will be online for only 48 hours as of now

i have commented on the errors and to show my logic

this method should work with any object i pass it so no object
structure is known
in advance.

the method should adapt to the constructor and all properties stored in
the database should be pu back into the object...

i m stuck

can someone please have a look.

Thanks

Alexandre

Nov 17 '05 #1
2 990
Alexandre,

It would seem to me that you should be doing this:

temp = construct[0].Invoke(constructorParameters);

Instead of this:

temp = o.GetType().GetConstructor(types).Invoke(construct orParameters);

Since you have the constructor already, and you call GetConstructor,
which could return something different than what is in construct[0].

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Alexandre" <al*****************@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Hi,

im currently working on making myself a MySql Object Abstraction Layer

so that i pass in objects and it does the database trasnsactions using
reflection
so far everything works except the select

since im trying to rebuild the objects in my method based on an object
i pass in
i am no able to instantiate the object and to give it its constructor
args or to set its properties

i have pasted my code here :
http://www.vkarlsen.no/pastebin/ViewPaste.aspx?id=5452

the code will be online for only 48 hours as of now

i have commented on the errors and to show my logic

this method should work with any object i pass it so no object
structure is known
in advance.

the method should adapt to the constructor and all properties stored in
the database should be pu back into the object...

i m stuck

can someone please have a look.

Thanks

Alexandre

Nov 17 '05 #2
i have also tryed

temp = Activator.CreateInstance(o.GetType(),constructorPa rameters);

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
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...
0
by: Alex Boev via DotNetMonster.com | last post by:
Hi! Sorry for my English. :) Please consider the following code: ---------------------------------------------------------------------------- - System.AppDomainSetup ap_setup = new...
10
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...
3
by: TT (Tom Tempelaere) | last post by:
Hi there I am making a service project in C#, and I'm in the process of writing the installer. I made an installer class by using the "Add Installer" menu-item in the design window of the service,...
1
by: Steen Tøttrup | last post by:
I don't know if there is another newsgroup where I should ask this question..?? I have this .NET web application that I've build using .NET 1.1. Now I've moved it to .NET 2.0 beta 2, and...
1
by: Sky Sigal | last post by:
(PS: Cross post from microsoft.pulic.dotnet.framework.aspnet.webcontrols) I've been looking lately for a way to keep the Properties panel for Controls 'clean'... My goal is to keep similar...
2
by: fabrice | last post by:
hello, I nedd help to create and use Library Satellite. I'm using Web Form under framework 1.1 and VB.NET I'm not using Visual Studio. I'd like to internationalize my web application with...
5
by: SunnyDrake | last post by:
HI! I wrting some program part of it is XML config parser which contains some commands(for flexibility of engenie). how do i more simple(if it possible not via System.Reflection or...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.