Base Classes On Proxy Objects

Sep 25, 2011

I have a webservice that is wrapped up by a data access object and is accessed by many different UI controls.

The proxy objects look something like this:

Public Class WebProxyObject1
' Common properties, there are about 10 of these
Public Name As String

[Code]....

View 1 Replies


ADVERTISEMENT

Derived Classes Cannot Raise Base Classes

Jul 10, 2009

I m trying to raise Click event of Textbox explictly but I m getting "Derived classes cannot raise base classes" error.[code]....

View 1 Replies

.net - Extending Web Service Proxy Classes?

Jul 28, 2011

I need to add functionality to my web service calls so object translation and automatic retries are done and abstracted away.I would usually override the base class to add the extra functionality, but as the proxy methods aren't over-ridable I can't keep the method names the same. The only other option I can think of to do it this way is to use the 'Shadows' keyword to achieve what I want.What other methods do people use to add functionality to their web service proxy classes without modifying the generated classes?

View 1 Replies

.net - Events In Base Classes?

May 19, 2009

i have a base class which declares the event StatusTextChanged. My child class, of course cannot directly raise this event.

[Code]...

View 5 Replies

C# - Using Many Classes In GUI That Inherit From A Base?

Oct 20, 2010

I have classes setup similar to this:

<DataContract()> _
Public MustInherit Class SystemTaskProcessBase
Public MustOverride ReadOnly Property Name() As String
Public MustOverride ReadOnly Property Description() As String
Public MustOverride Property Result() As SystemTaskResult

[Code]...

I need to use these classes on the client system, but also need to be able to create these "tasks" through a management interface. Each class (Task) that inherits the base, could have its own properties that are unique to each class, but at the same time, share the same common base class properties. For example, the above shows a reboot task and a delete file task, the delete file task needs to know which file to delete, so has a property for that. But the reboot task does not need this property. So when the management application is creating these tasks, it shouldn't provide a text box for the file property for the reboot task. There may be more tasks created at a later date with completely different properties.

How would I go about providing the WinForms management application a way to enumerate each class into a ListView for example, and allowing the user to create these tasks and filling in the dynamic properties that each class would have? Desired functionality would be to create a task form that creates dynamic controls available for the properties as needed, depending on the public properties in each class, but at the same time have the base class properties available as well.

View 1 Replies

Decouple WCF Service Proxy Classes From Environment Endpoints

Jun 28, 2011

I have a WCF Service, I won't waste anyone's time with copy/pasting a basic implementation here, just imagine it as being the standard "Echo" example you see scattered around MSDN. Let's say I host the Service Library using IIS / a web app. Let's also say I publish the website to varying environments, local, shared dev server, varying test servers, and of course varying live environments. We'll also assume that the WCF gods smiled down upon us and the deployments went without a hitch.

Now I want to write an app (lets say WPF app for some clarity). When the app starts, I want a drop down listing all the available environments. I don't mind hard-coding or supplying (by means of a config file) those environments, but kudos points for linking any articles showing LAN discovery of deployed WCF services?

When the user has selected their chosen environment, I want the app to be able to call a method on the service (in the correct environment). Now I could do this with a big select case/if statement, instantiating the appropriate proxy class for the environment selected, calling out using the proxy class, etc. I could even pass the class around from method to method as an object and then use select case/if statements alongside TryCast/DirectCast to ascertain which environment the provided proxy class belongs to.

I'm bordering on the idea of selecting an environment (none in particular, just one of them) and on the assumption that all deployments/environments have identical code, instantiate the proxy client with the endpoint details of my chosen environment. I lose a form of type safety, but is that ok? Is that the done way?

View 3 Replies

Make Base Interface For Generic Classes?

May 25, 2010

I'm trying to create a base interface for a class of mine that uses generics. However, I cannot figure out how to declare a property of the interface when its type won't be defined until the class is initialized.

To clarify, consider List(of T), which according to msdn, implements IList (among other things). Note that IList is not the same as its generic counterpart IList(Of T). So that mean any List(of T) can be converted to IList, which simply returns an object for its items. That's what I want to do with MyClass(of T), be able to cast it as IMyClass regardless of what T is.

But when I try such as:

Interface IMyClass
Prop A as Object
Class MyClass(of T) Implements IMyClass
Prop A as T Implements IMyClass.A

I get a signature error for the last line, even though object is broader than T. What am I doing wrong, or how exactly did Microsoft manage to make List(of T) implement IList?

View 9 Replies

VS 2008 Casting Subclasses, Base Classes?

Jun 26, 2010

I am a VB6 programmer learning VB.Net and am having trouble with the following concept.

[Code]...

View 4 Replies

Specifying Different Page Base Classes For Different Directories In Web.config File?

Mar 17, 2010

I have a website (coded in vb.net) with an "admin" section (the admin section being a folder in the actual site)... So in every page of the site I'm using my own custom class as the page base (which has been set in the web.config file) but I want to inherit from different class for the files in the "admin" folder... Is there any way to inherit different classes for pages in different folders using the web.config or some other equally as global method? (meaning some other way than inheriting on a per page basis.)

View 1 Replies

[2008] Base Class Inherited By 2 Derived Classes

Jan 30, 2009

i've finally got round to learning about classes and inheritance, but i'm not sure how to proceed. i have a base class Employee, which is inherited by 2 derived classes. how do i use the same Employee class in both derived classes? obviously if i write a sub new for both of them + declare a new Employee class, they won't be using the same class. heres my Employee class:

[Code]....

View 7 Replies

Binding NHibernate Proxy Objects To A DataGridView?

Jan 22, 2012

I am attempting to bind objects pulled from an NHibernate session to a DataGridView and am having problems.I have a single session in which I fetch all of my "look-up" items that are bound to a combobox column, and then I query for the objects themselves. omehow, this still results in proxy child objects on the main objects. I have even changed the mapping of the look-up items to eager fetch, but I still get proxies somehow.Here is how I am fetching the objects:

Dim _makes As IList(Of Make) = session.QueryOver(Of Make).List
Dim _models As IList(Of Model) = session.QueryOver(Of Model).List
Dim _cars as IList(of Car) = session.QueryOver(of Car).List

[code].....

View 1 Replies

Array Of Child Objects In Nested Classes And Accessing Child Objects In .Net

Jan 3, 2012

I have a nested class, let's call it class1 and it has class2 inside it; VB.Net eg:[code]

1) How can I define X number of Class2 objects[let's call it: Node(x) array]** with NEW() subroutine called?' this raises error: dim cls2(n) as new class2 end sub.

2) How can I return actual number of Node() array? [code]Outside my class in main project I define cls1 object:[code]Now an array of class2 is created inside cls1.

3) Now,How can I access All of them[node(x) array which is created inside cls1] with all properties and methods available?

I remember I wrote a ProcessManager class with this functionality in .net 2003, nearly 4 years age, I don't have the code now.

View 1 Replies

VS 2005 - How To Make Custom Base Classes Available To Future Programs

Oct 22, 2010

I have written multiple programs in the past that deal with cad data. Points, lines, arcs, etc. For each program I ended up creating slightly different versions of some really base classes like a class that defines a point:

<Serializable()> Public Class Point
Public x As Double = 0
Public y As Double = 0
Public z As Double = 0
End Class

My question is how would I use that class in such a way that it could be in a namespace and imported into any future project that I write?

View 2 Replies

Design Patterns - Inheritance - Do All Properties In The Derived Classes Have To Be Declared In The Base Class

Aug 8, 2011

Background:I have a base class and several inherited derived classes. The derived classes don't always need to have the same properties. If any properties are shared among the derived classes, those properties would live at the base class level ('Contents', for example).Similarly, GoodDocument below has 'GoodThings' but would not want/need to have 'BadThings'.I want to treat instances of both 'GoodDocument' and 'BadDocument' as type 'Document'

public mustinherit class Document
public property Contents as string
public sub new()...

[code]....

View 3 Replies

.net - LINQ Union Objects With Same Base Class?

Apr 5, 2011

I'm trying to create a list of all my objects from several lists of objects using Union.

Return Chart.AnnotativeNodes.Union( _
Chart.DecisionNodes.Union( _
Chart.EndNodes.Union( _
Chart.StartNodes.Union(Chart.WorkCenterNodes))))

The above line gets an error because I can't union List(of AnnotativeNode) with List(of DecisionNode). Each list defined like List(of EndNode) or List(of StartNode), but each class inherits from the base type Node.Is there a possible way to union these to get a result of IEnumerable(of Node)?

View 1 Replies

Classes And Objects?

Aug 29, 2010

The 1st part of the code required me to write a class definition for a class(Worker). The class should include Private variables and Property procedures for a worker object's name and salary.

The salary may contain a decimal place. The class should also contain two constructors:a default and a parameterized.

The second part for the code indicates that I need add a method named GetNewSalary to the Worker class.The method should calculate a Worker objects new salary, which is based on a raise percentage provided by the application using the object.

Before calculating the new salary, the method should verify that the raise percentage is greater than or equal to zero. If the raise percentage is less than zero the method should assign the number zero as the new salary

There are three text boxes which allows the user to enter the employees name current salary and raise percentage....the calculate button will display the new salary in the new salary label box...so far here is what I have for the worker class.

The Class for the code had to be written from scratch. Can you please look over the class code and see if I need to chang anything....that will allow the program to run.[code...]

View 1 Replies

Accessing Objects From Other Classes In ASP.NET

Sep 7, 2010

In ASP.NET I have a form that has a Textbox named txtOutput and a button. In the main file.aspx.vb I can call a function from the button handler and in that function I can have [code]I have a bunch of functions in several other classes. For instance I have a class named AbleCommerce that does some database functions. These functions are called from my main class. In those functions, however, I have no visibility of txtOutput.All of my classes are, unfortunately, in the default namespace which I understand is not optimal but didn't seem to impact this issue.

View 2 Replies

Collection Of Objects Of Different Classes?

Dec 28, 2011

suppose I have a collection of objects of different classes (like controls in a form), and all of their classes have a MyMethod extension method. How do I have the appropriatemethod be called for each object, depending on its type?or example,

For Each ctrl In Me.Controls
'call ctrl real type's MyMethod
Next

[code]....

View 6 Replies

Creating Classes And Objects?

Apr 10, 2011

1) Add a Private variable named _area2) Associate the _area variable with a Property procedure called Area3) Change the CalculateArea method to a Sub procedure. The method should calculate the area and then assign the result to the _area variable.4) Include a parameterized constructor in the class. The constructor should accept one argument: the side measurement. After using the Public property to initialize the Private variable, the constructor should automatically call the CalculateArea method.At this point I believe I've completed the first 2 steps for the Square method, but I'm not sure where to go from therHere is my code for the Square class and the Main Form, in tha order:

Public Class Square
Private _side As Integer
Private _area As Integer

[code].....

View 3 Replies

Programmed For A While And Mainly Used Classes As Objects?

Mar 5, 2010

Pursuing the Microsoft Certified Professional Developer Certification and working through the training kit.I've programmed for a while and mainly used classes as my objects.The training certification book I'm working through has a section on structures. they look very similiar to classes so my question is: why use them? Do they offer something that creating a class doesn't? What's the difference between structures and classes?

View 8 Replies

Trying To Understand Classes And Objects ?

Jun 5, 2010

I've been trying to understand classes and objects. Yes, I'm thick headed and slow, but I made the decision to go to .Net and I am determined to improve my coding skills to be more efficient. I have spoken to Atma several times on the topic and read most of his posts concerning classes and objects, but still came away a little baffled (He's really advanced for me yet). I needed a simplistic analogy for a reference point to begin understanding. I was reading about OOP written by MikeJ in the following thread/post ...[URL] and it all started to become clear in this statement , but I would like some reassurance that I'm getting it ..."A car IS-A vehicle, while a dog HAS-A tail. The car would be an object declared as type Vehicle, while the dog would have a member that IS-A tail. However, Fido IS-A dog. The dog class is the base template for all dog objects, so when we declare Fido as a dog, Fido is an object. Since Fido IS-A dog, Fido HAS-A tail."

From this I have taken the following understanding...

Vehicle ... ' Class
Car ....... ' Object
Truck ... ' Object
Van ....... ' Object

And from that can I infer that this is true?

Dog ....... ' Class
Fido ... ' Object
Tail .. ' Member of Fido

So to apply this to a program I wrote recently that tracks Generator service...

Generator ' Would be the class
Brand X ' Would be an object
Spark Plug ' Would be a member
Gas Tank ' Would be a member
Brand Y ' Would be an object
Brand Z ' Would be an object

This statement also helped ...

""Class" and "object" are sometimes used interchangeably. However, classes describe the structure of objects, while objects are instances of classes. Each instance is an exact copy of its base class. Because an object is an "instance" of a class, the act of creating an object is called instantiation. To describe it better, a class is a blueprint, and an object is a building based on that blueprint". I can understand this (I think) and it refers to a basic template such as ..."Generator" (my class or blueprint or template) Generators have an engine, powerplant, fuel tank, etc. These are basic requirements to be a generator. (Template or Blueprint) They can differ by Brand of engine, Size of powerplant, and type of fuel used. (Based on template or blueprint) Do I have it down now? MikeJ also made this statement ..."you can't access certain types of class members from outside of the class itself." From this I assume you would need to assign a Global variable the value of the class member if you needed to use it outside of the class?

View 17 Replies

What's The Relation Between Classes And Objects

Oct 14, 2009

relation between Classes and Objects with an example.Md. Marufuzzaman

View 7 Replies

C# - Dynamically Creating Objects At Runtime That Inherit From A Base Class

Apr 27, 2010

I am writing a game editor, and have a lot of different "tool" objects. They all inherit from BTool and have the same constructor. I would like to dynamically populate a toolbox at runtime with buttons that correspond to these tools, and when clicked have them create an instance of that tool and set it as the current tool. Is this possible, and if so will it be better/easier than creating those buttons by hand?

View 3 Replies

Creating A Class That Contains Other Classes/Objects?

Aug 27, 2010

I'm wondering on how you would go abouts instantiating a class that contains other complex objects. for example an Payment Class which has Date,Time, etc.. and it also holds a reference to a paymethod object which has id,Type,Description etc.. How do you instantiate the payment class with all the other objects without one or the other failing, how do you create the payment class which doesn

View 4 Replies

Multiple Classes For Serialize Objects?

May 9, 2009

I have one class with <Serialize> attribute called Tree. And Tree class has an arraylist of TreeNode classes. Is it possible to use Soap to convert the Tree class and arraylist of TreeNode classes to one xml file or binary file? If it is possible, do i need to use <Serialize> attribute on TreeNode classes too? If not, what should i do then?

View 3 Replies

Reference Objects On Webpages In The Classes

Feb 26, 2010

I have a project where a email is sent when the user clicks send on the web page, however the content of the email will change depending on what is inputted by the user. I have added classes to my project so that depending what is selected by the user different classes are selected and as such different emails then sent from the project.

[Code]...

View 9 Replies

Creating Classes For Master Child Objects

Dec 26, 2010

I have a Clients master object and then a number of child objects whose exact number is not known in advance such as Client-Contacts, Client-Payments etc, all of which have a one-to-many relationship with the Client master object.How do I define classes for such a scenario? Do I for instance create the master Clients class and can then I create an array of class somehow for child objects?

View 2 Replies

Easy Way To 'rewrite' To Take Advantage Of Classes And Objects?

Jul 2, 2009

I have a VB.NET web app that is about 2000 lines of code, contains about 20 different subroutines, and about 50 different functions.Is there an easy way to "rewrite" this to take advantage of classes and objects?

View 5 Replies

Make Classes/Modules/arrays And Objects?

May 18, 2010

This probably sounds daft, but im struggling to get to grips with Classes/Modules/arrays and objects, as well as there uses and what they are, and yes im still coding some how i hear you cry.The reason i ask is because Ive got a load of Dim's in my program that are the same giving locations of files and folders and wondered can they be used as a module that i can alter after the program is built, incase of folder locations being wrong or moved, manually correct after install.

View 1 Replies

VS2008/VB: Moving Subclass VB Code To Inherited Base Class - Where Should Variables/objects Be Declared

Jun 3, 2009

In re-engineering a windows forms application, I find that a lot of code-behind in the various form classes is duplicative and I'm trying to centralize as many procedures as possible into a base class which can be inherited and used by the subclassed forms.

This process seems to be going well and is making the code in my subclasses much simpler and hopefully easier to maintain, but I'm not sure where to draw the line between leaving code in the subclasses and engineering for generic resusability and moving it to the base class.

Specifically, in some subclasses I have code which manipulates variables and objects specific to the subclass, and although I could move the code-behind into the base class, the base class code references specific objects which are needed to compile. For example, each subclass manipulates a databound datagridview and form detail controls which allows the user to select between multi-record and detailed single-record views of a datatable.

In Visual Basic 2008 do I need to declare dummy data objects in the base class so that the base class will compile? Or is there a way to indicate that the data objects will be provided by the subclass?

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved