any example or guide on yadic?

18 views
Skip to first unread message

Misha Gringaouz

unread,
Jun 13, 2011, 8:22:22 AM6/13/11
to yadic
Hi,

I want to try yadic as I don't have any practice in using IOC's and
want to acquire some skill, but cant' find any example or guide on how
to use it.

How to start?

Thanks.

Daniel Worthington-Bodart

unread,
Jun 13, 2011, 8:53:28 AM6/13/11
to ya...@googlegroups.com
Hi Misha,

Are you planning to use Java, .NET or Ruby version?

Dan

Misha Gringaouz

unread,
Jun 13, 2011, 9:09:21 AM6/13/11
to yadic
Hi Dan,

I'm using F#

On Jun 13, 3:53 pm, Daniel Worthington-Bodart <d...@bodar.com> wrote:
> Hi Misha,
>
> Are you planning to use Java, .NET or Ruby version?
>
> Dan
>
> On 13 June 2011 13:22, Misha Gringaouz <mgringa...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I want to try yadic as I don't have any practice in using IOC's and
> > want to acquire some skill, but cant' find any example or guide on how
> > to use it.
>
> > How to start?
>
> > Thanks.- Hide quoted text -
>
> - Show quoted text -

Misha Gringaouz

unread,
Jun 13, 2011, 9:38:50 AM6/13/11
to yadic
.NET version
> > - Show quoted text -- Hide quoted text -

Daniel Worthington-Bodart

unread,
Jun 13, 2011, 10:43:07 AM6/13/11
to ya...@googlegroups.com
A good place to start is looking at the .NET tests


These are in C# even though the DI tool is written in F# mainly to ensure that SimpleContainer can be called from any .NET language.

There are only 3 methods to understand:
  • Add (Overloaded to allow you to add a type and an implementation or a type and a function / delegate that should create said type)
  • Resolve (Creates the type and any dependencies needed as needed)
  • Decorate ( Allows you to wrap another type enabling composition / delegation)
When constructing a SimpleContainer you can pass a reference to another container. This allows you to create as many scopes as you like in your application.

The last rule is that Yadic will only ever create an instance once and is defined by the lifetime of the container.

Play around and see how you get on...

Christian Blunden

unread,
Jun 14, 2011, 1:48:43 AM6/14/11
to ya...@googlegroups.com
Hi Misha,

Let me know how the C# examples work out for you. I can add some examples for the other .Net languages if this helps out

Cheers

Christian

Sent from my iPhone

Misha Gringaouz

unread,
Jun 14, 2011, 2:49:48 AM6/14/11
to yadic
Dan,
Thanks for the explanation. It definitely helps to start.

As I wanted to give a try I faced incompatibility problem when adding
reference to yadic dll from fsi

Microsoft (R) F# 2.0 Interactive build 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r @"C:\Downloads\yadic\yadic-72.dll";;

#r @"C:\Downloads\yadic\yadic-72.dll";;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

stdin(1,1): error FS0231: The F#-compiled DLL 'C:\Downloads\yadic
\yadic-72.dll' needs to be recompiled to be used with this version of
F#


On Jun 13, 5:43 pm, Daniel Worthington-Bodart <d...@bodar.com> wrote:
> A good place to start is looking at the .NET tests
>
> http://code.google.com/p/yadic/source/browse/src/Yadic.Tests/SimpleCo...
>
> These are in C# even though the DI tool is written in F# mainly to ensure
> that SimpleContainer can be called from any .NET language.
>
> There are only 3 methods to understand:
>
>    - Add (Overloaded to allow you to add a type and an implementation or a
>    type and a function / delegate that should create said type)
>    - Resolve (Creates the type and any dependencies needed as needed)
>    - Decorate ( Allows you to wrap another type enabling composition /
>    delegation)
>
> When constructing a SimpleContainer you can pass a reference to another
> container. This allows you to create as many scopes as you like in your
> application.
>
> The last rule is that Yadic will only ever create an instance once and is
> defined by the lifetime of the container.
>
> Play around and see how you get on...
>
> On 13 June 2011 14:09, Misha Gringaouz <mgringa...@gmail.com> wrote:
>
>
>
> > Hi Dan,
>
> > I'm using F#
>
> > On Jun 13, 3:53 pm, Daniel Worthington-Bodart <d...@bodar.com> wrote:
> > > Hi Misha,
>
> > > Are you planning to use Java, .NET or Ruby version?
>
> > > Dan
>
> > > On 13 June 2011 13:22, Misha Gringaouz <mgringa...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I want to try yadic as I don't have any practice in using IOC's and
> > > > want to acquire some skill, but cant' find any example or guide on how
> > > > to use it.
>
> > > > How to start?
>
> > > > Thanks.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -

Christian Blunden

unread,
Jun 14, 2011, 2:55:46 AM6/14/11
to ya...@googlegroups.com
Hi Misha

Hmm yes that will be a problem as we were using v1.9 of F#. We can get
another updated version sorted pretty quickly, but until then if you
are up for it, you can download the source code from google code and
re-compile with v2.0 of F#

Apologies for the inconvenience, I'll let you know when there is a new
version ready

Sent from my iPhone

Misha Gringaouz

unread,
Jun 14, 2011, 2:57:59 AM6/14/11
to yadic
Hi Chrisian,

SimpleContainer examples are allright but not demonstrative especially
for beginners like me.

I think more examples (in C#/F#) that show usability of yadic and how
to utilize it will help a lot!


On Jun 14, 8:48 am, Christian Blunden <christian.blun...@gmail.com>
wrote:
> Hi Misha,
>
> Let me know how the C# examples work out for you. I can add some examples
> for the other .Net languages if this helps out
>
> Cheers
>
> Christian
>
> Sent from my iPhone
>
> On 13 Jun 2011, at 03:43 PM, Daniel Worthington-Bodart <d...@bodar.com>
> wrote:
>
> A good place to start is looking at the .NET tests
>
> http://code.google.com/p/yadic/source/browse/src/Yadic.Tests/SimpleCo...
>
> These are in C# even though the DI tool is written in F# mainly to ensure
> that SimpleContainer can be called from any .NET language.
>
> There are only 3 methods to understand:
>
>    - Add (Overloaded to allow you to add a type and an implementation or a
>    type and a function / delegate that should create said type)
>    - Resolve (Creates the type and any dependencies needed as needed)
>    - Decorate ( Allows you to wrap another type enabling composition /
>    delegation)
>
> When constructing a SimpleContainer you can pass a reference to another
> container. This allows you to create as many scopes as you like in your
> application.
>
> The last rule is that Yadic will only ever create an instance once and is
> defined by the lifetime of the container.
>
> Play around and see how you get on...
>
> On 13 June 2011 14:09, Misha Gringaouz <mgringa...@gmail.com> wrote:
>
>
>
> > Hi Dan,
>
> > I'm using F#
>
> > On Jun 13, 3:53 pm, Daniel Worthington-Bodart <d...@bodar.com> wrote:
> > > Hi Misha,
>
> > > Are you planning to use Java, .NET or Ruby version?
>
> > > Dan
>
> > > On 13 June 2011 13:22, Misha Gringaouz <mgringa...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I want to try yadic as I don't have any practice in using IOC's and
> > > > want to acquire some skill, but cant' find any example or guide on how
> > > > to use it.
>
> > > > How to start?
>
> > > > Thanks.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -

Christian Blunden

unread,
Jun 14, 2011, 3:00:45 AM6/14/11
to ya...@googlegroups.com
Yeah I think that is fair, I have been meaning to write something up
for a long time. Let me put something together :)

Sent from my iPhone

Misha Gringaouz

unread,
Jun 21, 2011, 12:50:46 AM6/21/11
to yadic
Hope to see it soon.

On Jun 14, 10:00 am, Christian Blunden <christian.blun...@gmail.com>
wrote:
> Yeah I think that is fair, I have been meaning to write something up
> for a long time. Let me put something together :)
>
> Sent from my iPhone
>

Daniel Worthington-Bodart

unread,
Jun 21, 2011, 2:59:39 AM6/21/11
to ya...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages