Is there a nice way to bring a custom c sharp class into vl now?

I made a class using this and, while it might be easy (for someone with a bit of c sharp knowledge) to set it up in a dynamic plug-in, I would like to get it into vl somehow.

I’ve heard it mentioned that only a small modification is needed to import a source file into VL ( by sticking “< Node >” in it somewhere or something to that effect). Is that possible with the current version of VL?

Class example attached: SEDetail.zip (665 Bytes)

yes it is possible, but we want to wait with an official announcement since there is more to it then meets the eye. There will be a document that tells you all the details.

but for your personal experimentation, here is the unofficial quick guide:

  • locate the VL.Core.dll in the alpha download
  • reference it in your C# project
  • write a using clause for VL.Core in your class
  • use the Type attribute over your class (this is always required in order to make the Node attribute work)
  • use the Node attribute on every public method/property/field of your class that you want to turn into a VL node
  • compile the project as a DLL
  • reference this DLL as dependency in your .vl document
  • voila, use the data type and its nodes

it might look like this:

using System;
using VL.Core;

namespace MyVLNodes
{
    [Type] //this tells VL that the data type is available
    public class MyClass
    {
        [Node] //this makes a get and set node for MyField
        public int MyField;

        [Node] //this will also make get and set nodes
        public string MyProperty { get; set; }

        [Node] //this makes the Create node
        public MyClass(int initValue)
        {
            MyField = initValue;
        }

        [Node] //this makes a MyMethod node
        public bool MyMethod(int value)
        {
            return value < MyField;
        }
    }
}
1 Like

Thanks for that reply tonfilm, I look forward to playing!

I had a chance to ry making a class but I ran into a problem. each class that I put in had “k__backingfield” appended to it in VL.

The csharp file is pretty meaty but I don’t think it breaks with the syntax of the example in any way.

The only other potential discrepency i could point to is that I’m compiling my dll in Sharp Develop rather than Visual Studio 20xx.

dll enclosed

Apologies4theName.zip (6.0 KB)

its better to post the code than the compiled DLL.
sharpdx should use the same compiler than visual studio, unless you use the mono compiler.

just tested the DLL, works fine for me. i have a category SEDetails with a bunch of properly named nodes… are you using the latest alpha?

I don’t think its the mono compiler, I don’t think I\ve ever installed it on this machine.

The VL patch should show the output of the create SEObject node and demonstrate why its important I can get the right class parameters.

CustomclassTest.zip (28.2 KB)

ah… got it… what you are seeing is the auto generated backing field for the C# properties. that looks like a bug indeed.

I know there used to be a way to do a class import to vl with an xml file accompanying the dll. AFAIR, this could be done with the prototype importer, or by hand.

Of course this is much better if you want to include a lib which you don’t own the source code, or where you don’t want to introduce dependencies to VL, so just want to ask, if that is still a way to go about?

@velcrome there are different ways of getting nodes in vvvv, as roughly layed out here:
https://thegraybook.vvvv.org/reference/extending/overview.html

you’re mentioning the typeimporter we’ve demoed at node15, which produces .vlimport (xml) files. it is useful for some scenarios, not so useful for others. all should be more clear once we provide proper documentation (which is still in the making) for the different options you have.

Hi,
Following up on previous work I have had some success but now I’m trying to import some MongoDB nodes and I get this error:

"...because there's no import set for the return type 'MongoDB.Driver.IMongoClient'"

How can I import these non generic types?

heads up on this thread…
as announced here: https://vvvv.org/blog/devvvvlopment-update-january-2017 the way we import libraries will change and infos leaked in this thread may no longer work (still shouldn’t be too hard to fix then, just saying…)

having said that…what have you done to get that error?

Happened just because…!

Having another look at MongoDB again with the alpha. Its quite a tricky library to import becaue it has Linq-style queries for finding for sifting, but they made their own probably for efficiency. Making a delegate with the right signature isn’t enough to build a query so I’m suspecting I may have to either muck around with the forwarding/ the interfaces or a combination of both and other things.

However, for now wanted to know how to make custom regions.

An example signature of the actual where operation as as found in the project manager is:

Where<TSource>(IMongoQueryable<TSource> Source, Expression<Func<TSource, Boolean>> predicate): IMongoQueryable<Source>

I think I’ve seen an example somewhere but I can’t recall where. Maybe at Praxis?

Here we go, please see:

and please best start a new forum thread for questions regarding specific libraries.

NOTE: This works with latest alphas and will be included in beta36!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.