Hi Welly,

I'm not very familiar with .NET or the C# Avro library, hopefully others
can help answer your specific question. One alternative is to look at the
Microsoft C# library, which also has codegen features and is intended for
use for .NET:


https://azure.microsoft.com/en-us/updates/microsoft-avro-library-updated-to-include-c-code-generator/

rb

On Mon, Sep 5, 2016 at 5:12 AM, Welly Tambunan <if05...@gmail.com> wrote:

> Hi All,
>
> I'm trying to port apache avro to .NET core.
>
> Here's the repository for the project
>
> https://github.com/welly87/Apache-Avro-Core
>
>
> However i found that some of the class and method is missing regarding
> Assembly loading and IL generation. I'm really close to completing the
> porting.
>
> [image: Inline image 1]
>
> #1. Is there any replacement on this line of code in .NET core ?
> Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
>
> #2. Another one is IL Generator. Any idea how to replace this code ?
>
>         public CtorDelegate GetConstructor(string name, Schema.Type
> schemaType, Type type)
>         {
>             ConstructorInfo ctorInfo = type.GetConstructor(Type.Empty
> Types);
>             if (ctorInfo == null)
>                 throw new AvroException("Class " + name + " has no default
> constructor");
>
>             DynamicMethod dynMethod = new DynamicMethod("DM$OBJ_FACTORY_"
> + name, typeof(object), null, type, true);
>             ILGenerator ilGen = dynMethod.GetILGenerator();
>             ilGen.Emit(OpCodes.Nop);
>             ilGen.Emit(OpCodes.Newobj, ctorInfo);
>             ilGen.Emit(OpCodes.Ret);
>
>             return (CtorDelegate)dynMethod.CreateDelegate(ctorType);
>         }
>
> Thanks
>
> Cheers
> --
> Welly Tambunan
> Triplelands
>
> http://weltam.wordpress.com
> http://www.triplelands.com <http://www.triplelands.com/blog/>
>



-- 
Ryan Blue
Software Engineer
Netflix

Reply via email to