Beispiel #1
0
        public void RegisterCrossBindingAdaptor(CrossBindingAdaptor adaptor)
        {
            var bType = adaptor.BaseCLRType;

            if (bType != null)
            {
                if (!crossAdaptors.ContainsKey(bType))
                {
                    var t   = adaptor.AdaptorType;
                    var res = GetType(t);
                    if (res == null)
                    {
                        res = new CLRType(t, this);
                        mapType[res.FullName]            = res;
                        mapType[t.AssemblyQualifiedName] = res;
                        clrTypeMapping[t] = res;
                    }
                    adaptor.RuntimeType  = res;
                    crossAdaptors[bType] = adaptor;
                }
                else
                {
                    throw new Exception("Crossbinding Adapter for " + bType.FullName + " is already added.");
                }
            }
            else
            {
                var bTypes = adaptor.BaseCLRTypes;
                var t      = adaptor.AdaptorType;
                var res    = GetType(t);
                if (res == null)
                {
                    res = new CLRType(t, this);
                    mapType[res.FullName]            = res;
                    mapType[t.AssemblyQualifiedName] = res;
                    clrTypeMapping[t] = res;
                }
                adaptor.RuntimeType = res;

                foreach (var i in bTypes)
                {
                    if (!crossAdaptors.ContainsKey(i))
                    {
                        crossAdaptors[i] = adaptor;
                    }
                    else
                    {
                        throw new Exception("Crossbinding Adapter for " + i.FullName + " is already added.");
                    }
                }
            }
        }
Beispiel #2
0
 public void RegisterCrossBindingAdaptor(CrossBindingAdaptor adaptor)
 {
     if (!crossAdaptors.ContainsKey(adaptor.BaseCLRType))
     {
         var t   = adaptor.AdaptorType;
         var res = GetType(t);
         if (res == null)
         {
             res = new CLRType(t, this);
             mapType[res.FullName]            = res;
             mapType[t.AssemblyQualifiedName] = res;
             clrTypeMapping[t] = res;
         }
         adaptor.RuntimeType = res;
         crossAdaptors[adaptor.BaseCLRType] = adaptor;
     }
 }