public IList <PRelation> getAllRelation()
            {
                //"SELECT * FROM SystemRelation", "system_relation")

                var     relations = new List <PRelation>();
                DataSet dts       = new DataSet();

                try
                {
                    dts.Tables.Add(ConcreteDb.Instance.getDataTable("SELECT * FROM SystemRelation", "system_relation"));
                    foreach (DataRow row in dts.Tables["system_relation"].Rows)
                    {
                        string  relationname = row[1].ToString();
                        PSchema schema       = SchemaService.Instance().getSchemeById(Convert.ToInt16(row[2]));
                        var     tuple        = PTupleService.Instance().getAllTupleByRelationName(relationname, schema.Attributes);
                        if (tuple is null)
                        {
                            tuple = new List <PTuple>();
                        }
                        PRelation relation = new PRelation(Convert.ToInt16(row[0]), schema, relationname, tuple);
                        relations.Add(relation);
                    }
                }
                catch
                {
                }

                return(relations);
            }
        public PDatabase OpenExistingDatabase(ref PDatabase pDatabase)
        {
            //reset Concrete
            ConcreteDb.Instance.resetConnection();
            try
            {
                //IList<PSchema> Schemas = new List<PSchema>();
                var Schemas = SchemaService.Instance().getAllScheme();
                pDatabase.Schemas = Schemas;

                //IList<PRelation> relations = new List<PRelation>();
                var relations = RelationService.Instance().getAllRelation();
                pDatabase.Relations = relations;

                //var querys = new List<PQuery>();
                var querys = QueryService.Instance().getAllQuery();
                pDatabase.Queries = querys;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Notification");

                return(null);
            }
            return(pDatabase);
        }
        protected virtual void ParseField([NotNull] ItemParseContext context, [NotNull] Template template, [NotNull] TemplateSection templateSection, [NotNull] ITextNode templateFieldTextNode, ref int nextSortOrder)
        {
            SchemaService.ValidateTextNodeSchema(templateFieldTextNode, "TemplateField");

            GetName(context.ParseContext, templateFieldTextNode, out var fieldName, out var fieldNameTextNode, "Field", "Name");
            if (string.IsNullOrEmpty(fieldName))
            {
                Trace.TraceError(Msg.P1005, Texts._Field__element_must_have_a__Name__attribute, templateFieldTextNode.Snapshot.SourceFile.AbsoluteFileName, templateFieldTextNode.TextSpan);
                return;
            }

            var templateField = templateSection.Fields.FirstOrDefault(f => string.Equals(f.FieldName, fieldName, StringComparison.OrdinalIgnoreCase));

            if (templateField == null)
            {
                var itemIdOrPath = template.ItemIdOrPath + "/" + templateSection.SectionName + "/" + fieldName;
                var guid         = StringHelper.GetGuid(template.Project, templateFieldTextNode.GetAttributeValue("Id", itemIdOrPath));

                templateField = Factory.TemplateField(template, guid).With(templateFieldTextNode);
                templateSection.Fields.Add(templateField);
                templateField.FieldNameProperty.SetValue(fieldNameTextNode);
                templateField.FieldName = fieldName;
            }

            templateField.TypeProperty.Parse(templateFieldTextNode, "Single-Line Text");
            templateField.Shared      = string.Equals(templateFieldTextNode.GetAttributeValue("Sharing"), "Shared", StringComparison.OrdinalIgnoreCase);
            templateField.Unversioned = string.Equals(templateFieldTextNode.GetAttributeValue("Sharing"), "Unversioned", StringComparison.OrdinalIgnoreCase);
            templateField.SourceProperty.Parse(templateFieldTextNode);
            templateField.ShortHelpProperty.Parse(templateFieldTextNode);
            templateField.LongHelpProperty.Parse(templateFieldTextNode);
            templateField.SortorderProperty.Parse(templateFieldTextNode, nextSortOrder);

            nextSortOrder = templateField.Sortorder + 100;

            // set field standard value
            var standardValueTextNode = templateFieldTextNode.GetAttribute("StandardValue");

            if (standardValueTextNode != null && !string.IsNullOrEmpty(standardValueTextNode.Value))
            {
                if (template.StandardValuesItem == null)
                {
                    Trace.TraceError(Msg.P1006, Texts.Template_does_not_a_standard_values_item, standardValueTextNode);
                }
                else
                {
                    var field = template.StandardValuesItem.Fields.GetField(templateField.FieldName);
                    if (field == null)
                    {
                        field = Factory.Field(template.StandardValuesItem).With(standardValueTextNode);
                        field.FieldNameProperty.SetValue(fieldNameTextNode);
                        template.StandardValuesItem.Fields.Add(field);
                    }

                    field.ValueProperty.SetValue(standardValueTextNode);
                }
            }

            template.References.AddRange(ReferenceParser.ParseReferences(template, templateField.SourceProperty));
        }
 public static SchemaService Instance()
 {
     lock (synclock)
     {
         if (instance == null)
         {
             instance = new SchemaService();
         }
     }
     return(instance);
 }
示例#5
0
文件: Startup.cs 项目: stofte/frank
        public void ConfigureServices(IServiceCollection services)
        {
            var schemaService    = new SchemaService();
            var compiler         = new CompileService(schemaService);
            var dbContextService = new DatabaseContextService(schemaService, compiler);
            var queryService     = new QueryService(compiler, dbContextService, schemaService);

            services.AddSingleton <QueryService>(queryService);
            services.AddSingleton <SchemaService>(schemaService);
            services.AddSingleton <CompileService>(compiler);
            services.AddSingleton <DatabaseContextService>(dbContextService);
        }
示例#6
0
        public void AddNewSchema_CreateNewSchema()
        {
            // Arrange
            mockSchemaRepository = new Mock<IRepository<Schema>>();
            var schemaService = new SchemaService(mockSchemaRepository.Object, mapper);
            var schemaDomain = new SchemaDomain();
            // Act
            schemaService.AddNewSchema(schemaDomain);

            // Assert
            mockSchemaRepository.Verify(x => x.Create(It.IsAny<Schema>()), Times.Once);
        }
示例#7
0
 public Program()
 {
     this.schemaRepository = new SchemaRepository();
     this.schemaService    = new SchemaService(
         new List <IClassOverride>()
     {
         new AddQueryInputPropertyToSearchAction(),
         new AddTextTypeToActionTarget(),
         new AddNumberTypeToMediaObjectHeightAndWidth(),
     },
         new List <IEnumerationOverride>()
     {
         new WarnEmptyEnumerations(),
     },
         this.schemaRepository);
 }
示例#8
0
        public void SaveSchema_ShouldCreateNewSchema()
        {
            // Arrange
            mockSchemaRepository = new Mock<IRepository<Schema>>();
            var schemaService = new SchemaService(mockSchemaRepository.Object, mapper);
            var schemaDomain = new SchemaDomain()
            {
                Data = "Data",
                Name = "Name"
            };

            // Act
            schemaService.SaveSchema("Name", schemaDomain);

            // Assert
            mockSchemaRepository.Verify(x => x.Create(It.IsAny<Schema>()), Times.Once);
        }
示例#9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            SchemaService.Initialize();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                //app.UseHsts();
            }

            //app.UseHttpsRedirection();
            app.UseCors(opts => opts.AllowAnyMethod().AllowAnyOrigin().WithHeaders("Content-Type", "Authorization"));
            app.UseMiddleware <TokenAuthService>();

            app.UseRouting();
            app.UseEndpoints(endpoints => endpoints.MapControllers());
        }
        protected virtual void ParseSection([NotNull] ItemParseContext context, [NotNull] Template template, [NotNull] ITextNode templateSectionTextNode)
        {
            if (string.Equals(templateSectionTextNode.Value, "__Standard Values", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            SchemaService.ValidateTextNodeSchema(templateSectionTextNode, "TemplateSection");

            GetName(context.ParseContext, templateSectionTextNode, out var sectionName, out var sectionNameTextNode, "Section", "Name");
            if (string.IsNullOrEmpty(sectionName))
            {
                Trace.TraceError(Msg.P1007, Texts._Section__element_must_have_a__Name__attribute, sectionNameTextNode);
                return;
            }

            var templateSection = template.Sections.FirstOrDefault(s => string.Equals(s.SectionName, sectionName, StringComparison.OrdinalIgnoreCase));

            if (templateSection == null)
            {
                var itemIdOrPath = template.ItemIdOrPath + "/" + sectionName;
                var guid         = StringHelper.GetGuid(template.Project, templateSectionTextNode.GetAttributeValue("Id", itemIdOrPath));

                templateSection = Factory.TemplateSection(template, guid).With(templateSectionTextNode);
                templateSection.SectionNameProperty.SetValue(sectionNameTextNode);
                templateSection.SectionName = sectionName;

                template.Sections.Add(templateSection);
            }

            templateSection.IconProperty.Parse(templateSectionTextNode);

            var nextSortOrder = 0;

            foreach (var fieldTextNode in templateSectionTextNode.ChildNodes)
            {
                ParseField(context, template, templateSection, fieldTextNode, ref nextSortOrder);
            }
        }
示例#11
0
        public void GetSchema_GetSchemaByName()
        {
            // Arrange
            mockSchemaRepository = new Mock<IRepository<Schema>>();
            var list = new List<Schema>()
            {
                new Schema()
                {
                    Id = "1",
                    Data = "Data",
                    Name = "Name"
                },
            };
            mockSchemaRepository.Setup(x => x.Get(It.IsAny<Expression<Func<Schema, bool>>>())).Returns(list);
            var schemaService = new SchemaService(mockSchemaRepository.Object, mapper);
            var schemaDomain = new SchemaDomain();

            // Act
            var res = schemaService.GetSchema("Name");

            // Assert
            mockSchemaRepository.Verify(x => x.Get(It.IsAny<Expression<Func<Schema, bool>>>()), Times.Once);
        }
 public int getNextIdSch()
 {
     return(SchemaService.Instance().getNextIdSch());
 }
示例#13
0
        public static void Main(string[] args)
        {
            SchemaService service = new SchemaService();

            //IMoodle moodle = new DumbMoodle();
            ////SchemaPlanner planner = new SchemaPlanner();

            //foreach (var room in moodle.Rooms)
            //    Console.WriteLine(room);

            //Console.ReadLine();

            //foreach (var hold in moodle.Hold)
            //    Console.WriteLine(hold);

            //Console.ReadLine();

            //foreach (var teacher in moodle.Teachers)
            //    Console.WriteLine(teacher);

            //Console.ReadLine();

            //Console.WriteLine(moodle.LookupTeacher("PAN"));

            //Console.ReadLine();

            //Console.WriteLine(moodle.LookupHold("MTH2014"));

            //Console.ReadLine();

            //foreach (var teacherCode in moodle.Teachers.Select(t => t.LaererKode))
            //    Console.WriteLine(moodle.LookupTeacher(teacherCode));

            //Console.ReadLine();

            //foreach (var holdCode in moodle.Hold.Select(h => h.HoldCode))
            //    Console.WriteLine(moodle.LookupHold(holdCode));

            //Console.ReadLine();

            //foreach (var course in moodle.Courses)
            //    Console.WriteLine(course);

            //Console.ReadLine();


            // MasterSchema masterSchema = planner.GenerateSchema(moodle);



            //create a schema for kursus with this id ALG100:
            Skema kursusSkema = service.CreateKursusSkema("ALG100");

            foreach (var item in kursusSkema.LectureList)
            {
                Console.WriteLine(item.ToString());
            }

            Console.ReadLine();

            //create a schema for teacher with this initials: PJE
            Skema teacherSkema = service.CreateTeacherSkema("PAN");

            foreach (var item in teacherSkema.LectureList)
            {
                Console.WriteLine(item.ToString());
            }

            Console.ReadLine();

            //create a schema for lokale with this id: BH112
            Skema lokaleSkema = service.CreateLokaleSkema("BH112");

            foreach (var item in lokaleSkema.LectureList)
            {
                Console.WriteLine(item.ToString());
            }


            Console.ReadLine();

            //create a schema for a group/hold with id: MTH2014
            Skema holdSkema = service.CreateHoldSkema("MTH2014");

            foreach (var item in holdSkema.LectureList)
            {
                Console.WriteLine(item.ToString());
            }

            Console.ReadKey();
        }
        public override void Parse(ItemParseContext context, ITextNode textNode)
        {
            SchemaService.ValidateTextNodeSchema(textNode, "Template");

            var itemNameTextNode = GetItemNameTextNode(context.ParseContext, textNode);
            var parentItemPath   = textNode.GetAttributeValue("ParentItemPath", context.ParentItemPath);
            var itemIdOrPath     = textNode.GetAttributeValue("ItemPath");

            if (string.IsNullOrEmpty(itemIdOrPath))
            {
                itemIdOrPath = PathHelper.CombineItemPath(parentItemPath, itemNameTextNode.Value);
            }
            else if (itemNameTextNode.Value != Path.GetFileName(itemIdOrPath))
            {
                Trace.TraceError(Msg.P1034, "Item name in 'ItemPath' and 'Name' does not match. Using 'Name'");
            }

            var guid         = StringHelper.GetGuid(context.ParseContext.Project, textNode.GetAttributeValue("Id", itemIdOrPath));
            var databaseName = textNode.GetAttributeValue("Database", context.Database.DatabaseName);
            var database     = context.ParseContext.Project.GetDatabase(databaseName);

            var template = Factory.Template(database, guid, itemNameTextNode.Value, itemIdOrPath);

            template.ItemNameProperty.AddSourceTextNode(itemNameTextNode);
            template.BaseTemplatesProperty.Parse(textNode, Constants.Templates.StandardTemplateId);
            template.IconProperty.Parse(textNode);
            template.ShortHelpProperty.Parse(textNode);
            template.LongHelpProperty.Parse(textNode);

            template.IsEmittable = textNode.GetAttributeBool(Constants.Fields.IsEmittable, true);
            template.IsImport    = textNode.GetAttributeBool(Constants.Fields.IsImport, context.IsImport);

            template.References.AddRange(ReferenceParser.ParseReferences(template, template.BaseTemplatesProperty));

            Item standardValuesItem;
            var  standardValuesTextNode = textNode.ChildNodes.FirstOrDefault(n => string.Equals(n.Value, "__Standard Values", StringComparison.OrdinalIgnoreCase));

            if (standardValuesTextNode != null)
            {
                var newContext = Factory.ItemParseContext(context.ParseContext, context.Parser, template.Database, template.ItemIdOrPath, template.IsImport);
                context.Parser.ParseTextNode(newContext, standardValuesTextNode);
                standardValuesItem = template.Database.GetItem(template.ItemIdOrPath + "/__Standard Values");

                if (standardValuesItem == null)
                {
                    Trace.TraceError(Msg.C1137, "'__Standard Values' item not parsed correctly", standardValuesTextNode);
                }
            }
            else
            {
                // create standard values item
                var standardValuesItemIdOrPath = itemIdOrPath + "/__Standard Values";
                var standardValuesGuid         = StringHelper.GetGuid(context.ParseContext.Project, standardValuesItemIdOrPath);
                standardValuesItem = Factory.Item(database, standardValuesGuid, "__Standard Values", standardValuesItemIdOrPath, itemIdOrPath).With(textNode);
                context.ParseContext.Project.AddOrMerge(standardValuesItem);
            }

            if (standardValuesItem != null)
            {
                // todo: should be Uri
                template.StandardValuesItem = standardValuesItem;
                standardValuesItem.IsImport = template.IsImport;
            }

            // parse fields and sections
            foreach (var sectionTreeNode in textNode.ChildNodes)
            {
                ParseSection(context, template, sectionTreeNode);
            }

            Pipelines.GetPipeline <TemplateParserPipeline>().Execute(context, template, textNode);

            context.ParseContext.Project.AddOrMerge(template);
        }
 public PSchema Delete(PSchema pSchema)
 {
     return(SchemaService.Instance().Delete(pSchema));
 }
示例#16
0
        static void Run(RunOptions options)
        {
            var logger = new ConsoleLogger(options.LogLevel);

            var operations = new List <Autofac.Core.IModule> {
                new JintTransformModule(),
                new RazorTransformModule(),
                new FluidTransformModule(),
                new HumanizeModule(),
                new LambdaParserModule()
            };

            // todo: geoCode, etc

            using (var outer = new ConfigurationContainer(operations.ToArray()).CreateScope(options.ArrangementWithMode(), logger, options.GetParameters())) {
                var process = outer.Resolve <Process>();

                if (options.Mode != "default" && options.Mode != process.Mode)
                {
                    process.Mode = options.Mode;
                    process.Load();
                }

                if (process.Errors().Any())
                {
                    var context = new PipelineContext(logger, process);
                    context.Error("The configuration has errors.");
                    foreach (var error in process.Errors())
                    {
                        context.Error(error);
                    }
                    Environment.Exit(1);
                }

                var providers = new List <Autofac.Core.IModule> {
                    new ConsoleProviderModule()
                };

                var output = process.GetOutputConnection();

                if (output == null || output.Provider == "internal" || output.Provider == "console")
                {
                    logger.SuppressConsole();
                    if (options.Format == "csv")
                    {
                        output.Provider    = "file"; // delimited file
                        output.Delimiter   = ",";
                        output.Stream      = true;
                        output.Synchronous = true; // got odd results when using Async methods
                        output.File        = "dummy.csv";
                        providers.Add(new CsvHelperProviderModule(Console.OpenStandardOutput()));
                    }
                    else
                    {
                        output.Provider = "json";
                        output.Stream   = true;
                        output.Format   = "json";
                        output.File     = "dummy.json";
                        providers.Add(new JsonProviderModule(Console.OpenStandardOutput()));
                    }
                }
                else
                {
                    providers.Add(new CsvHelperProviderModule());
                    providers.Add(new JsonProviderModule());
                }

                // PROVIDERS
                providers.Add(new AdoProviderModule());
                providers.Add(new BogusModule());
                providers.Add(new SqliteModule());
                providers.Add(new SqlServerModule());
                providers.Add(new PostgreSqlModule());
                providers.Add(new MySqlModule());
                providers.Add(new ElasticsearchModule());
                providers.Add(new RazorProviderModule());
                providers.Add(new AwsCloudWatchProviderModule());
                providers.Add(new AmazonConnectProviderModule());
                providers.Add(new MailModule());
                // solr

                var modules = providers.Union(operations).ToArray();

                if (options.Mode.ToLower() == "schema")
                {
                    using (var inner = new Container(modules).CreateScope(process, logger)) {
                        process = new SchemaService(inner).GetProcess(process);
                        process.Connections.Clear();
                        Console.WriteLine(process.Serialize());
                        Environment.Exit(0);
                    }
                }
                else if (process.Entities.Count == 1 && !process.Entities[0].Fields.Any(f => f.Input))
                {
                    using (var inner = new Container(modules).CreateScope(process, logger)) {
                        if (new SchemaService(inner).Help(process))
                        {
                            process.Load();
                        }
                        else
                        {
                            Console.Error.WriteLine($"Unable to detect fields in {process.Entities[0].Name}.");
                            Environment.Exit(1);
                        }
                    }
                }

                using (var inner = new Container(modules).CreateScope(process, logger)) {
                    inner.Resolve <IProcessController>().Execute();
                }
            }
        }
示例#17
0
        private async Task MainAsync()
        {
            ThreadPool.SetMinThreads(32, 32);
            ThreadPool.SetMaxThreads(128, 128);

            Console.WriteLine("Starting PluralKit...");

            InitUtils.Init();

            // Set up a CancellationToken and a SIGINT hook to properly dispose of things when the app is closed
            // The Task.Delay line will throw/exit (forgot which) and the stack and using statements will properly unwind
            var token = new CancellationTokenSource();

            Console.CancelKeyPress += delegate(object e, ConsoleCancelEventArgs args)
            {
                args.Cancel = true;
                token.Cancel();
            };

            var builder = new ContainerBuilder();

            builder.RegisterInstance(_config);
            builder.RegisterModule(new ConfigModule <BotConfig>("Bot"));
            builder.RegisterModule(new LoggingModule("bot"));
            builder.RegisterModule(new MetricsModule());
            builder.RegisterModule <DataStoreModule>();
            builder.RegisterModule <BotModule>();

            using var services = builder.Build();

            var logger = services.Resolve <ILogger>().ForContext <Initialize>();

            try
            {
                SchemaService.Initialize();

                var coreConfig = services.Resolve <CoreConfig>();
                var botConfig  = services.Resolve <BotConfig>();
                var schema     = services.Resolve <SchemaService>();

                using var _ = Sentry.SentrySdk.Init(coreConfig.SentryUrl);

                logger.Information("Connecting to database");
                await schema.ApplyMigrations();

                logger.Information("Connecting to Discord");
                var client = services.Resolve <DiscordShardedClient>();
                await client.LoginAsync(TokenType.Bot, botConfig.Token);

                logger.Information("Initializing bot");
                await client.StartAsync();

                await services.Resolve <Bot>().Init();

                try
                {
                    await Task.Delay(-1, token.Token);
                }
                catch (TaskCanceledException) { } // We'll just exit normally
            }
            catch (Exception e)
            {
                logger.Fatal(e, "Unrecoverable error while initializing bot");
            }

            logger.Information("Shutting down");
        }
示例#18
0
 public DebugHandler(RequestDelegate next, SchemaService service, CompileService compileService, DatabaseContextService dbContextService) : base(next)
 {
     _schemaService    = service;
     _compileService   = compileService;
     _dbContextService = dbContextService;
 }
示例#19
0
 public SchemaController(IOptions <ManagerConfiguration> managerConfiguration, SchemaService schemaService)
 {
     this.schemaService        = schemaService;
     this.managerConfiguration = managerConfiguration;
 }
示例#20
0
 public void TestInitialize()
 {
     service = new SchemaService();
 }
 public PSchema getSchemeById(int id)
 {
     return(SchemaService.Instance().getSchemeById(id));
 }
示例#22
0
        public async Task <(CredentialIssueMessage, CredentialRecord)> CreateCredentialAsync(IAgentContext agentContext, string credentialId, IEnumerable <CredentialPreviewAttribute> values)
        {
            var credential = await GetAsync(agentContext, credentialId);

            if (credential.State != CredentialState.Requested)
            {
                throw new AgentFrameworkException(ErrorCode.RecordInInvalidState,
                                                  $"Credential state was invalid. Expected '{CredentialState.Requested}', found '{credential.State}'");
            }

            if (values != null && values.Any())
            {
                credential.CredentialAttributesValues = values;
            }

            var definitionRecord =
                await SchemaService.GetCredentialDefinitionAsync(agentContext.Wallet, credential.CredentialDefinitionId);

            var connection = await ConnectionService.GetAsync(agentContext, credential.ConnectionId);

            var provisioning = await ProvisioningService.GetProvisioningAsync(agentContext.Wallet);

            if (connection.State != ConnectionState.Connected)
            {
                throw new AgentFrameworkException(ErrorCode.RecordInInvalidState,
                                                  $"Connection state was invalid. Expected '{ConnectionState.Connected}', found '{connection.State}'");
            }

            string            revocationRegistryId = null;
            BlobStorageReader tailsReader          = null;

            if (definitionRecord.SupportsRevocation)
            {
                var revocationRecordSearch = await RecordService.SearchAsync <RevocationRegistryRecord>(
                    agentContext.Wallet, SearchQuery.Equal(nameof(RevocationRegistryRecord.CredentialDefinitionId), definitionRecord.Id), null, 5);

                var revocationRecord = revocationRecordSearch.Single(); // TODO: Credential definition can have multiple revocation registries

                revocationRegistryId = revocationRecord.Id;
                tailsReader          = await TailsService.OpenTailsAsync(revocationRecord.TailsFile);
            }

            var issuedCredential = await AnonCreds.IssuerCreateCredentialAsync(agentContext.Wallet, credential.OfferJson,
                                                                               credential.RequestJson, CredentialUtils.FormatCredentialValues(credential.CredentialAttributesValues), revocationRegistryId, tailsReader);

            if (definitionRecord.SupportsRevocation)
            {
                var paymentInfo = await PaymentService.GetTransactionCostAsync(agentContext, TransactionTypes.REVOC_REG_ENTRY);

                await LedgerService.SendRevocationRegistryEntryAsync(
                    wallet : agentContext.Wallet,
                    pool : await agentContext.Pool,
                    issuerDid : provisioning.IssuerDid,
                    revocationRegistryDefinitionId : revocationRegistryId,
                    revocationDefinitionType : "CL_ACCUM",
                    value : issuedCredential.RevocRegDeltaJson,
                    paymentInfo : paymentInfo);

                credential.CredentialRevocationId = issuedCredential.RevocId;

                if (paymentInfo != null)
                {
                    await RecordService.UpdateAsync(agentContext.Wallet, paymentInfo.PaymentAddress);
                }
            }

            await credential.TriggerAsync(CredentialTrigger.Issue);

            await RecordService.UpdateAsync(agentContext.Wallet, credential);

            var threadId = credential.GetTag(TagConstants.LastThreadId);

            var credentialMsg = new CredentialIssueMessage
            {
                Credentials = new []
                {
                    new Attachment
                    {
                        Id       = "libindy-cred-0",
                        MimeType = CredentialMimeTypes.ApplicationJsonMimeType,
                        Data     = new AttachmentContent
                        {
                            Base64 = issuedCredential.CredentialJson
                                     .GetUTF8Bytes()
                                     .ToBase64String()
                        }
                    }
                }
            };

            credentialMsg.ThreadFrom(threadId);

            return(credentialMsg, credential);
        }
 public PSchema Insert(PSchema pSchema)
 {
     return(SchemaService.Instance().Insert(pSchema));
 }
示例#24
0
 public IEnumerable <IParameter> GetParameters()
 {
     return(SchemaService.GetParameters());
 }
 public PSchema Update(PSchema pSchema)
 {
     return(SchemaService.Instance().Update(pSchema));
 }