Beispiel #1
0
        /// <summary>
        /// Define a vertex type and register with CRA.
        /// </summary>
        /// <param name="vertexDefinition">Name of the vertex type</param>
        /// <param name="creator">Lambda that describes how to instantiate the vertex, taking in an object as parameter</param>
        public async Task <CRAErrorCode> DefineVertexAsync(string vertexDefinition, Expression <Func <IVertex> > creator)
        {
            if (_artifactUploading)
            {
                using (var stream = await _blobStorage.GetWriteStream(vertexDefinition + "/binaries"))
                {
                    AssemblyUtils.WriteAssembliesToStream(stream);
                }
            }

            var newInfo = VertexInfo.Create(
                "",
                vertexDefinition,
                vertexDefinition,
                "",
                0,
                creator,
                null,
                true,
                false);

            await _vertexManager.VertexInfoProvider.InsertOrReplace(newInfo);

            return(CRAErrorCode.Success);
        }