OrientDB-NET.binary icon indicating copy to clipboard operation
OrientDB-NET.binary copied to clipboard

_database.Create.Class<T>().Extends<OVertex>().CreateProperties().Run();

Open ghost opened this issue 8 years ago • 5 comments

I am trying to implement a simple generic method to automatically generate properties of a T generic type. Currently the code throws an object reference exception.

ghost avatar Sep 13 '16 18:09 ghost

Can you please attach a code sample of your implementation.

GrayDelacluyse avatar Sep 13 '16 18:09 GrayDelacluyse

Thanks for your quick response. I am thinking that if i have many classes that i need to map their properties, there should a generic way to do this. See sample code below.

private void MapAllClasses(string MappingAssesmbly) { var types = Assembly.Load(MappingAssesmbly).GetTypes().Where(p => typeof(IMappable).IsAssignableFrom(p) && p.IsClass && !p.IsAbstract);

        foreach (Type type in types)
        {
            MapClass(type);
        }
    }
    private void MapClass<T>(T someObject)
    { 
        _database.Create.Class<T>().Extends<OVertex>().CreateProperties().Run();
    }

MapAllClasses could be called from anywhere like this MapAllClasses("OrientDBDemo");

ghost avatar Sep 13 '16 19:09 ghost

have you been able to fix this???

edikep2000 avatar Feb 25 '17 21:02 edikep2000

No I have not. Is there a solution i can apply.

Regards, Christian Madubuko

On Sat, Feb 25, 2017 at 10:07 PM, edikep2000 [email protected] wrote:

have you been able to fix this???

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/orientechnologies/OrientDB-NET.binary/issues/118#issuecomment-282512463, or mute the thread https://github.com/notifications/unsubscribe-auth/AVJswjzX1g-oNhL4vm14xYj0iCiaYZ3Rks5rgJgDgaJpZM4J8BOJ .

ghost avatar Feb 27 '17 08:02 ghost

please share me the code for oreintdb 2.2.33 database connection through c#.net

user33 avatar Sep 18 '18 03:09 user33