예제 #1
0
        private void ConvertThroughProto(Identifier source)
        {
            Com.Daml.Ledger.Api.V1.Identifier protoValue = source.ToProto();
            var test = Identifier.FromProto(protoValue);

            Assert.True(source == test);
        }
예제 #2
0
#pragma warning disable CS0612
        public static Identifier FromProto(Com.Daml.Ledger.Api.V1.Identifier identifier)
        {
            if (!string.IsNullOrEmpty(identifier.ModuleName) && !string.IsNullOrEmpty(identifier.EntityName))
            {
                return(new Identifier(identifier.PackageId, identifier.ModuleName, identifier.EntityName));
            }

            throw new ArgumentException($"Invalid identifier {identifier}: both module_name and entity_name must be set.");
        }