コード例 #1
0
ファイル: VersionController.cs プロジェクト: Selvana-Liza/LR4
        public ActionResult <string> Get()
        {
            var versionInfo = new to.Models.Version
            {
                Company        = Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyCompanyAttribute>().Company,
                Product        = Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyProductAttribute>().Product,
                ProductVersion = Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyInformationalVersionAttribute>().InformationalVersion
            };

            return(Ok(versionInfo));
        }
コード例 #2
0
        public ActionResult <string> Get()
        {
            Log.Information("Acquiring version info");
            Log.Warning("Some warning");
            Log.Error("Here comes an error");
            var versionInfo = new to.Models.Version
            {
                Company        = Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyCompanyAttribute>().Company,
                Product        = Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyProductAttribute>().Product,
                ProductVersion = Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyInformationalVersionAttribute>().InformationalVersion
            };

            Log.Information($"Acquired version is {versionInfo.ProductVersion}");
            Log.Debug($"Full version info: {@versionInfo}");

            return(Ok(versionInfo));
        }