Blog Home  Home Feed your aggregator (RSS 2.0)  
A Random Walk Around .Net - Does It Work???
 
 Saturday, April 12, 2008

To test this, we decided to setup an interface and two derived classes.  Then we added corresponding data to the database (we will build an intuitive graphical user interface eventually).  Finally, we used the Container Singleton class to resolve our types and print out the results.

 

            Class Diagram:

Database:

 

            Windsor Component View

Lookup Name

Namespace

Contract

Implementation

Component Id

Contract Id

Test1

DBinsor.Svc.WCF.Client

IMath

Add

1844d2e0-455e-4d44-a9ff-1c63f78e407b

0aa71152-91d4-4e8f-a4a0-4124a98e2851

Test1

DBinsor.Svc.WCF.Client

IMath

Subtract

5c3ee79a-926c-4438-8391-44a437bd8f47

0aa71152-91d4-4e8f-a4a0-4124a98e2851

           

            Windsor Parameters View

Component Id

Contract Id

Parm Name

Default

Override

5c3ee79a-926c-4438-8391-44a437bd8f47

0aa71152-91d4-4e8f-a4a0-4124a98e2851

a

1

13

5c3ee79a-926c-4438-8391-44a437bd8f47

0aa71152-91d4-4e8f-a4a0-4124a98e2851

b

2

NULL

1844d2e0-455e-4d44-a9ff-1c63f78e407b

0aa71152-91d4-4e8f-a4a0-4124a98e2851

a

1

NULL

1844d2e0-455e-4d44-a9ff-1c63f78e407b

0aa71152-91d4-4e8f-a4a0-4124a98e2851

b

2

NULL

 

            Classes:

 

            Test:

IMath proxy = ContainerSingleton.Instance.Resolve<Add, IMath>();

Console.WriteLine(proxy.Calculate().ToString());

 

proxy = ContainerSingleton.Instance.Resolve<Subtract, IMath>();

Console.WriteLine(proxy.Calculate().ToString());

 

Console.WriteLine(ContainerSingleton.Instance.Xml);

           

            Result:

3

 

11

 

<configuration>

  <components>

    <component id="DBinsor.Svc.WCF.Client.Add"

service="DBinsor.Svc.WCF.Client.IMath, DBinsor.Svc.WCF.Client" type="DBinsor.Svc.WCF.Client.Add, DBinsor.Svc.WCF.Client">

      <parameters>

        <a>1</a>

        <b>2</b>    

      </parameters>

    </component>

    <component id="DBinsor.Svc.WCF.Client.Subtract"

service="DBinsor.Svc.WCF.Client.IMath, DBinsor.Svc.WCF.Client" type="DBinsor.Svc.WCF.Client.Subtract, DBinsor.Svc.WCF.Client">

      <parameters>

        <a>13</a>

        <b>2</b>

      </parameters>

    </component>

  </components>

</configuration>

Saturday, April 12, 2008 5:19:55 PM (Central Standard Time, UTC-06:00)  #    Comments [0]    | 
Copyright © 2009 Yezdaan Baber. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: