You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Humphrey <hm...@gmail.com> on 2017/05/04 13:19:49 UTC

Resource Injection in .NET

This question is related to .NET with C#.

I have a class that implements IComputeJob, which prints out a line in the
console.
How can I inlcude the IgniteInstanceName in the Console.WriteLine method?

I know in Java you can inject the Ignite instace in the method, but I don't
know how I should do it in C#.

In Java:
@IgniteInstanceResource
private Ignite ignite;

I'm just upgraded everything to ignite 2.0.0 with NUGET.

Humphrey



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Resource-Injection-in-NET-tp12420.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Resource Injection in .NET

Posted by Pavel Tupitsyn <pt...@apache.org>.
Alternatively, you can just call Ignition.GetIgnite().

On Thu, May 4, 2017 at 4:27 PM, Pavel Tupitsyn <pt...@apache.org> wrote:

> It is similar to Java, use [InstanceResource] attribute:
>
>     class MyJob : IComputeJob<object>
>     {
>         [InstanceResource] private IIgnite _ignite;
>
>         public object Execute()
>         {
>             Console.WriteLine(_ignite.Name);
>              ...
>         }
>         ....
>     }
>
>
> On Thu, May 4, 2017 at 4:19 PM, Humphrey <hm...@gmail.com> wrote:
>
>> This question is related to .NET with C#.
>>
>> I have a class that implements IComputeJob, which prints out a line in the
>> console.
>> How can I inlcude the IgniteInstanceName in the Console.WriteLine method?
>>
>> I know in Java you can inject the Ignite instace in the method, but I
>> don't
>> know how I should do it in C#.
>>
>> In Java:
>> @IgniteInstanceResource
>> private Ignite ignite;
>>
>> I'm just upgraded everything to ignite 2.0.0 with NUGET.
>>
>> Humphrey
>>
>>
>>
>> --
>> View this message in context: http://apache-ignite-users.705
>> 18.x6.nabble.com/Resource-Injection-in-NET-tp12420.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>
>

Re: Resource Injection in .NET

Posted by Pavel Tupitsyn <pt...@apache.org>.
There is no peer class loading in .NET (yet).

I'm working on this feature right now, hopefully it will be released in 2.1:
https://issues.apache.org/jira/browse/IGNITE-2492

On Thu, May 4, 2017 at 4:35 PM, Humphrey <hm...@gmail.com> wrote:

> Thanks.
>
> I can't seem to find the PeerClassLoading method in IgniteConfiguration. Is
> there one?
>
> Humphrey
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Resource-Injection-in-NET-tp12420p12424.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Resource Injection in .NET

Posted by Humphrey <hm...@gmail.com>.
Thanks.

I can't seem to find the PeerClassLoading method in IgniteConfiguration. Is
there one?

Humphrey



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Resource-Injection-in-NET-tp12420p12424.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Resource Injection in .NET

Posted by Pavel Tupitsyn <pt...@apache.org>.
It is similar to Java, use [InstanceResource] attribute:

    class MyJob : IComputeJob<object>
    {
        [InstanceResource] private IIgnite _ignite;

        public object Execute()
        {
            Console.WriteLine(_ignite.Name);
             ...
        }
        ....
    }


On Thu, May 4, 2017 at 4:19 PM, Humphrey <hm...@gmail.com> wrote:

> This question is related to .NET with C#.
>
> I have a class that implements IComputeJob, which prints out a line in the
> console.
> How can I inlcude the IgniteInstanceName in the Console.WriteLine method?
>
> I know in Java you can inject the Ignite instace in the method, but I don't
> know how I should do it in C#.
>
> In Java:
> @IgniteInstanceResource
> private Ignite ignite;
>
> I'm just upgraded everything to ignite 2.0.0 with NUGET.
>
> Humphrey
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Resource-Injection-in-NET-tp12420.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>