Dynamic public property generation

F

funVB2005fun

I am not quite sure what I am getting into but I would like to have a loop
that read from a flat file to create some public properties in a class. I
am going after this to try and create more general software that others
could benefit from vs hardcoding things that relate only to my processes.

example property that I would want to generate:
The idea would be to read from a file that "AGE" is needed and that it is
and Integer and then to create the property in a class. This is related to
DotNetNuke 3.x

I do know one method relates to having a class that manipulates the class
file that need to be dynamic... Any thoughts on this or successful
attempts?

*************************************************
Public Property Age() As Integer
Get
Return _Age
End Get
Set(ByVal Value As Integer)
_Age = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
**************************************************
 
C

Cor Ligthert

FunVB

Are you talking about a schoolclass, or about the class as we know it, what
is a very solid base for all OOP objects?

Cor
 
F

funVB2005fun

Could you please expand on the schoolclass topic. I am not familiar with
that but am open to all possibilities.


If you are talking specifically about DNN I have a new class that is
inheriting from DotNetNuke.Entities.Users.UserProfile


Public Class GroUserProfile
Inherits DotNetNuke.Entities.Users.UserProfile



****************************************************************
Full Code of class I want to auto generate properties from a flat
file. specifically so it is possible for an end user to add user
attributes without haveing to recompile and edit several class files.
****************************************************************
Namespace GRO.Users

Public Class GroUserProfile
Inherits DotNetNuke.Entities.Users.UserProfile

Private _GroLocation As String
Private _Age As Integer
Private _UserClasses As String
Private _Gender As String
Private _Registrar As String
Private _Title As String
Private _Organization As String


Public Sub New()
End Sub

Public Property GroLocation() As String
Get
Return _GroLocation
End Get
Set(ByVal Value As String)
_GroLocation = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
Public Property Age() As Integer
Get
Return _Age
End Get
Set(ByVal Value As Integer)
_Age = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
Public Property UserClasses() As String
Get
Return _UserClasses
End Get
Set(ByVal Value As String)
_UserClasses = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
Public Property Gender() As String
Get
Return _Gender
End Get
Set(ByVal Value As String)
_Gender = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
Public Property Registrar() As String
Get
Return _Registrar
End Get
Set(ByVal Value As String)
_Registrar = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
Public Property Title() As String
Get
Return _Title
End Get
Set(ByVal Value As String)
_Title = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
Public Property Organization() As String
Get
Return _Organization
End Get
Set(ByVal Value As String)
_Organization = Value
If Not ObjectHydrated Then
ObjectHydrated = True
End If
End Set
End Property
End Class
End Namespace
 
C

Cor Ligthert

Fun,

You are not the first one who is busy with this. You can be the first one
who realise this correct from a point of the end-users view.

What you try to do endless done. To call some which still exist: SQL,
JavaScript, VBScript, the first generations FoxPro's, MS-Access, Excel,
hundreds or thousands or probably even more don't exist anymore.

I do not have the idea that it is handy for somebody who knows real tools,
while the end-user don't use them. There are complete developers groups now
around those so called easy solutions/languages.

You can try to find that never really good functioning developed wheel.
However I think that it is than a long lonely route to go.

However just my thought,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top