Exemplo n.º 1
0
    /// <summary>
    ///     The default constuctor
    /// </summary>
    protected LaunchPadFunctionStartup()
    {
        _builder = new ConventionContextBuilder(new Dictionary <object, object?>())
                   .UseAppDomain(AppDomain.CurrentDomain)
                   .Set(HostType.Live);
        if (this is IConvention convention)
        {
            _builder.AppendConvention(convention);
        }

        // TODO: Restore this sometime
        // var functionsAssembly = this.GetType().Assembly;
        // var location = Path.GetDirectoryName(functionsAssembly.Location);
        // DependencyContext? dependencyContext = null;
        // while (!string.IsNullOrEmpty(location))
        // {
        //     var depsFilePath = Path.Combine(location, functionsAssembly.GetName().Name + ".deps.json");
        //     if (File.Exists(depsFilePath))
        //     {
        //         using var stream = File.Open(depsFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
        //         using var reader = new DependencyContextJsonReader();
        //         dependencyContext = reader.Read(stream);
        //         break;
        //     }
        //
        //     location = Path.GetDirectoryName(location);
        // }
    }
Exemplo n.º 2
0
 /// <summary>
 ///     The default constructor with the given configuration method
 /// </summary>
 /// <param name="configure"></param>
 protected LaunchPadFunctionStartup(Func <LaunchPadFunctionStartup, ConventionContextBuilder> configure)
 {
     _builder = configure(this).Set(HostType.Live);
     if (this is IConvention convention)
     {
         _builder.AppendConvention(convention);
     }
 }