コード例 #1
0
        protected override int CompareBindingPrecidence <TExodata, TContext, TSubject>(IExodataRequest <TExodata, TContext, TSubject> request, IExodataBinding left, IExodataBinding right)
        {
            var l = left as IExodataBindingDetails;
            var r = right as IExodataBindingDetails;

            if (left == null || right == null)
            {
                return(0);
            }

            bool leftIsAttributeBinding  = l.Source is AttributeExodataBindingSource;
            bool rightIsAttributeBinding = r.Source is AttributeExodataBindingSource;

            if (leftIsAttributeBinding ^ rightIsAttributeBinding)
            {
                return(leftIsAttributeBinding ? 1 : -1);
            }

            bool leftBoundToContext  = l.BoundToContextInstance;
            bool rightBoundToContext = r.BoundToContextInstance;

            if (leftBoundToContext ^ rightBoundToContext)
            {
                return(leftBoundToContext ? -1 : 1);
            }

            bool leftBoundToSubject  = l.BoundToSubjectInstance;
            bool rightBoundToSubject = r.BoundToSubjectInstance;

            if (leftBoundToSubject ^ rightBoundToSubject)
            {
                return(leftBoundToSubject ? -1 : 1);
            }

            bool leftBoundToSymbol  = l.BoundToSymbolInstance;
            bool rightBoundToSymbol = r.BoundToSymbolInstance;

            if (leftBoundToSymbol ^ rightBoundToSymbol)
            {
                return(leftBoundToSymbol ? -1 : 1);
            }

            if (l.ContextType != r.ContextType)
            {
                return(l.ContextType.IsAssignableFrom(r.ContextType) ? 1 : -1);
            }

            if (l.SubjectType != r.SubjectType)
            {
                return(l.SubjectType.IsAssignableFrom(r.SubjectType) ? 1 : -1);
            }

            return(0);
        }
コード例 #2
0
 protected virtual int CompareBindingPrecidence <TExodata, TContext, TSubject>(IExodataRequest <TExodata, TContext, TSubject> request, IExodataBinding left, IExodataBinding right)
 {
     return(0);
 }