Ejemplo n.º 1
0
        public BuildNumber GetBuildInfo()
        {
            using (_contextPool.AllocateOperationContext(out TransactionOperationContext context))
                using (var tx = context.OpenReadTransaction())
                {
                    var table = tx.InnerTransaction.OpenTable(_licenseStorageSchema, LicenseInfoSchema.LicenseTree);

                    TableValueReader infoTvr;
                    using (Slice.From(tx.InnerTransaction.Allocator, nameof(BuildNumber), out Slice keyAsSlice))
                    {
                        // it seems like the database was shutdown rudely and never wrote it stats onto the disk
                        if (table.ReadByKey(keyAsSlice, out infoTvr) == false)
                        {
                            return(null);
                        }
                    }

                    using (var blittable = Read(context, ref infoTvr))
                    {
                        return(JsonDeserializationServer.BuildNumber(blittable));
                    }
                }
        }