Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Skrypnyk 6182 posts 24284 karma points MVP 9x admin c-trib
    Jan 29, 2020 @ 00:58
    Alex Skrypnyk
    0

    How can I create RelationType with code?

    Found this code -

    var relationType = new RelationType(new Guid("A7CE7344-9A2E-4567-8BC9-8901BB9B9F5B"),new Guid("F65E0D53-E0A9-46D9-94D7-EA5009E48D55"), "relationTypeAlias", "Relation Type Name"){IsBidirectional = true};
        ApplicationContext.Services.RelationService.Save(relationType);
    

    Is it relevant? How to get these guids?

    Alex

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 9x admin c-trib
    Jan 29, 2020 @ 10:44
    Alex Skrypnyk
    100
    var relationService = applicationContext.Services.RelationService;
            var connectionRelation =
                relationService.GetRelationTypeByAlias("alias");
    
            if (connectionRelation == null)
            {
                var relationType = new RelationType(new Guid("39eb0f98-b348-42a1-8662-e7eb18487560"), new Guid("39eb0f98-b348-42a1-8662-e7eb18487560"), "alias", "name") { IsBidirectional = false };
                relationService.Save(relationType);
            }
    

    This is the way it works.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies