GFlisch / Arc4u

Apache License 2.0
22 stars 17 forks source link

Arc4u 8+: IApplicationContext.Principal must be nullable #125

Open vvdb-architecture opened 3 weeks ago

vvdb-architecture commented 3 weeks ago

The IApplicationContext interface provides a principal. However, this principal might not always be present.

This is tested in most places in the framework code, but to benefit from nullable warning during compilation, the specification of the Principal property interface should be changed to reflect this:

public interface IApplicationContext
    {
        AppPrincipal? Principal { get; }

        /// <summary>
        /// Gets or sets the activity ID.
        /// </summary>
        /// <value>The activity ID.</value>
        string ActivityID { get; set; }

        void SetPrincipal(AppPrincipal principal);
    }

There is at least one use case where SetPrincipal(null) would make sense, but I'm not sure if this would warrant making the parameter nullable as well. To be discussed.