473,395 Members | 1,554 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,395 software developers and data experts.

Dynamic Properties

I would like to know if anyone can suggest how to implement the following:

We need to have classes who's properties are defined by a database. The
properties can not be hard coded. In addition properties datatype will also
be defined by the database and are subject to change in the future. So a
property that may return an int could in the future return a bool value.

Two questions:

1. How do you implement said senerio?

2. How do you implement it in a such a way that if the return value changes
your application can roll with it rather than causing an exception?

--Demetri
Jul 21 '05 #1
5 1422
Using standard coding techniques, you are pretty much lost. In .NET, however,
you do have a very real option using Reflection and code generation.
Reflection.Emit is what you want to examine. It allows you to take code
created on the fly and compile in memory and use in your process. If the
dynamic classes are called again, you do have the option of saving off the
code. Not the easiest to implement, but flexibility is always a bit more time
consuming.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Demetri" wrote:
I would like to know if anyone can suggest how to implement the following:

We need to have classes who's properties are defined by a database. The
properties can not be hard coded. In addition properties datatype will also
be defined by the database and are subject to change in the future. So a
property that may return an int could in the future return a bool value.

Two questions:

1. How do you implement said senerio?

2. How do you implement it in a such a way that if the return value changes
your application can roll with it rather than causing an exception?

--Demetri

Jul 21 '05 #2
"=?Utf-8?B?RGVtZXRyaQ==?=" <De*****@discussions.microsoft.com> wrote in
news:C9**********************************@microsof t.com:
I would like to know if anyone can suggest how to implement the
following:

We need to have classes who's properties are defined by a database.
The properties can not be hard coded. In addition properties datatype
will also be defined by the database and are subject to change in the
future. So a property that may return an int could in the future
return a bool value.

Two questions:

1. How do you implement said senerio?

2. How do you implement it in a such a way that if the return value
changes your application can roll with it rather than causing an
exception?

--Demetri


There are some publications that could be helpful for you:

Yoder J.W.; Johnson, R.: The adaptive object-model architectural style.
http://www.adaptiveobjectmodel.com/W...AOMsWICSA3.htm

Riehle, D.; Tilman, M.; Johnson, R.: Dynamic Object Model. PLoP 2000

At least you should have a look at http://www.adaptiveobjectmodel.com/

Daniel
Jul 21 '05 #3
Demetri,

What you want is in my opinion late binding. You can do that using Option
Strict Of in VBNet or reflection in another program language. However keep
in mind that both will decrease your performance.

Cor
Jul 21 '05 #4
Define what you mean by "Properties"..

What you describe differs in many respects from "Properties" as defined
in C#. Before we can give you any meaningful answer, we need to know what
features of C# properties are needed in these "Properties". (Notably, we'd
need to know how & where you plan as access these properties)

--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...
I would like to know if anyone can suggest how to implement the following:

We need to have classes who's properties are defined by a database. The
properties can not be hard coded. In addition properties datatype will also be defined by the database and are subject to change in the future. So a
property that may return an int could in the future return a bool value.

Two questions:

1. How do you implement said senerio?

2. How do you implement it in a such a way that if the return value changes your application can roll with it rather than causing an exception?

--Demetri

Jul 21 '05 #5
From what you said i suppose you need variant datatype which in .NET is the
object class which is able to store (box) any datatype .
please give more details in order to help in the design

"Daniel Faensen" <Fa******@NOSPAM.rki.de> wrote in message
news:33*************@individual.net...
"=?Utf-8?B?RGVtZXRyaQ==?=" <De*****@discussions.microsoft.com> wrote in
news:C9**********************************@microsof t.com:
I would like to know if anyone can suggest how to implement the
following:

We need to have classes who's properties are defined by a database.
The properties can not be hard coded. In addition properties datatype
will also be defined by the database and are subject to change in the
future. So a property that may return an int could in the future
return a bool value.

Two questions:

1. How do you implement said senerio?

2. How do you implement it in a such a way that if the return value
changes your application can roll with it rather than causing an
exception?

--Demetri


There are some publications that could be helpful for you:

Yoder J.W.; Johnson, R.: The adaptive object-model architectural style.
http://www.adaptiveobjectmodel.com/W...AOMsWICSA3.htm

Riehle, D.; Tilman, M.; Johnson, R.: Dynamic Object Model. PLoP 2000

At least you should have a look at http://www.adaptiveobjectmodel.com/

Daniel

Jul 21 '05 #6

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

Similar topics

1
by: jm | last post by:
I am using (trying) dynamic properties to store a database connection. However, I don't have a connection object on the form. I just do a OdbcConnection in my code. So I can't use the VS IDE to...
2
by: Codex Twin | last post by:
Hi I am designing a class (Q) which will contain provision for dynamic complex properties. For example, these properties could be any or all of the following complex properties: a)...
3
by: cwertman | last post by:
I have a question regarding dynamic properties. I have an Object say Account --Id --Prefix --Fname --Lname --Suffix
0
by: vnu | last post by:
Hi, Hi, I am working in .net emvironment using vs2005 and vb.net as the language. In one of my project, I need to display the properties of a com object which has dynamic properties(late bind...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
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
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...

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.