当前位置: 首页>>代码示例>>C#>>正文


C# ObjRef.IsWellKnown方法代码示例

本文整理汇总了C#中System.Runtime.Remoting.ObjRef.IsWellKnown方法的典型用法代码示例。如果您正苦于以下问题:C# ObjRef.IsWellKnown方法的具体用法?C# ObjRef.IsWellKnown怎么用?C# ObjRef.IsWellKnown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Runtime.Remoting.ObjRef的用法示例。


在下文中一共展示了ObjRef.IsWellKnown方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsWellFormed

        } // ShouldUseUrlObjRef
        

        // Check whether the objref is well formed
        internal static bool IsWellFormed(ObjRef objectRef)
        {
            // We skip the wellformed check for wellKnown, 
            // objref-lite and custom objrefs
            bool wellFormed = true;
            if (   (null == objectRef)     
                || (null == objectRef.URI) 
                || (!(objectRef.IsWellKnown()  
                      || objectRef.IsObjRefLite() 
                      || objectRef.GetType() != orType
                     ) 
                    && (null == objectRef.ChannelInfo)
                   )
               )
            {
                wellFormed = false;
            }

            return wellFormed;
        }
开发者ID:ArildF,项目名称:masters,代码行数:24,代码来源:objref.cs

示例2: IsWellFormed

 internal static bool IsWellFormed(ObjRef objectRef)
 {
     bool flag = true;
     return ((((objectRef != null) && (objectRef.URI != null)) && ((objectRef.IsWellKnown() || objectRef.IsObjRefLite()) || ((objectRef.GetType() != orType) || (objectRef.ChannelInfo != null)))) && flag);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:ObjRef.cs

示例3: InternalUnmarshal

        [System.Security.SecurityCritical]  // auto-generated
        internal static Object InternalUnmarshal( 
            ObjRef objectRef,
            Object proxy,
            bool fRefine)
        { 
            Object obj = null;
            Identity idObj = null; 
 
            Context currContext = Thread.CurrentContext;
            Message.DebugOut("RemotingServices::InternalUnmarshal: <Begin> Current context id: " +  (currContext.ContextID).ToString("x") + "\n"); 

            // This routine can be supplied a custom objref or an objref
            // generated by us. We do some sanity checking on the objref
            // to make sure that it is valid 
            if (!ObjRef.IsWellFormed(objectRef))
            { 
                throw new ArgumentException( 
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString( 
                        "Argument_BadObjRef"),
                    "Unmarshal"));
            }
 
            // If it is a well known objectRef we need to just connect to
            // the URL inside the objectRef. 
            if (objectRef.IsWellKnown()) 
            {
                obj = Unmarshal( 
                            typeof(System.MarshalByRefObject),
                            objectRef.URI);
                // ensure that we cache the objectRef in the ID
                // this contains type-info and we need it for 
                // validating casts on the wellknown proxy
                // Note: this code path will be relatively rare ... the case 
                // when a well known proxy is passed to a remote call 
                // Otherwise it will be wise to another internal flavor of
                // Unmarshal call that returns the identity as an out param. 
                idObj = IdentityHolder.ResolveIdentity(objectRef.URI);
                if (idObj.ObjectRef == null)
                {
                    idObj.RaceSetObjRef(objectRef); 
                }
                return obj; 
            } 

            Message.DebugOut("RemotingService::InternalUnmarshal IN URI" + objectRef.URI); 
            // Get the identity for the URI
            idObj = IdentityHolder.FindOrCreateIdentity(objectRef.URI, null, objectRef);

            currContext = Thread.CurrentContext; 
            Message.DebugOut("RemotingServices::Unmarshal: <after FindOrCreateIdentity> Current context id: " +
                             (currContext.ContextID).ToString("x") + "\n"); 
 
            // If we successfully completed the above method then we should
            // have an identity object 
            BCLDebug.Assert(null != idObj,"null != idObj");


            Message.DebugOut("RemotingService::InternalUnmarshal IN URI" + objectRef.URI); 

            Message.DebugOut("RemotingServices::InternalUnmarshal: <Begin> Current context id: " + 
                             (currContext.ContextID).ToString("x") + "\n"); 

 
            // Check whether we are on the server side or client-side
            ServerIdentity serverID = idObj as ServerIdentity;
            if ( serverID != null )
            { 
                Message.DebugOut("RemotingServices::InternalUnmarshal: Unmarshalling ServerIdentity\n");
 
                // SERVER SIDE 
                // We are in the app domain of the server object.
                // If we are in the same context as the server then 
                // just return the server object else return the proxy

                currContext = Thread.CurrentContext;
                Message.DebugOut("RemotingServices::InternalUnmarshal: Current context id: " + 
                                 (currContext.ContextID).ToString("x") + "\n");
                Message.DebugOut("RemotingServices::InternalUnmarshal: ServerContext id: " + 
                                 (serverID.ServerContext.ContextID).ToString("x") + "\n"); 

                if (!serverID.IsContextBound) 
                {
                    BCLDebug.Assert(serverID.ServerType.IsMarshalByRef,
                                    "Object must be at least MarshalByRef in order to be marshaled");
                    if (proxy != null) 
                    {
                        throw new ArgumentException( 
                            String.Format( 
                                CultureInfo.CurrentCulture, Environment.GetResourceString(
                                    "Remoting_BadInternalState_ProxySameAppDomain"))); 
                    }
                    obj = serverID.TPOrObject;
                }
                else 
                {
                        Message.DebugOut("RemotingServices::InternalUnmarshal: Contexts don't match, returning proxy\n"); 
 
                        IMessageSink chnlSink = null;
//.........这里部分代码省略.........
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:101,代码来源:RemotingServices.cs

示例4: InternalUnmarshal

 internal static object InternalUnmarshal(ObjRef objectRef, object proxy, bool fRefine)
 {
     object tPOrObject = null;
     Identity idObj = null;
     Context currentContext = Thread.CurrentContext;
     if (!ObjRef.IsWellFormed(objectRef))
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_BadObjRef"), new object[] { "Unmarshal" }));
     }
     if (objectRef.IsWellKnown())
     {
         tPOrObject = Unmarshal(typeof(MarshalByRefObject), objectRef.URI);
         idObj = IdentityHolder.ResolveIdentity(objectRef.URI);
         if (idObj.ObjectRef == null)
         {
             idObj.RaceSetObjRef(objectRef);
         }
         return tPOrObject;
     }
     idObj = IdentityHolder.FindOrCreateIdentity(objectRef.URI, null, objectRef);
     Context context2 = Thread.CurrentContext;
     ServerIdentity identity2 = idObj as ServerIdentity;
     if (identity2 != null)
     {
         Context context3 = Thread.CurrentContext;
         if (!identity2.IsContextBound)
         {
             if (proxy != null)
             {
                 throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadInternalState_ProxySameAppDomain"), new object[0]));
             }
             tPOrObject = identity2.TPOrObject;
         }
         else
         {
             IMessageSink chnlSink = null;
             IMessageSink envoySink = null;
             CreateEnvoyAndChannelSinks(identity2.TPOrObject, null, out chnlSink, out envoySink);
             SetEnvoyAndChannelSinks(idObj, chnlSink, envoySink);
             tPOrObject = GetOrCreateProxy(idObj, proxy, true);
         }
     }
     else
     {
         IMessageSink sink3 = null;
         IMessageSink sink4 = null;
         if (!objectRef.IsObjRefLite())
         {
             CreateEnvoyAndChannelSinks(null, objectRef, out sink3, out sink4);
         }
         else
         {
             CreateEnvoyAndChannelSinks(objectRef.URI, null, out sink3, out sink4);
         }
         SetEnvoyAndChannelSinks(idObj, sink3, sink4);
         if (objectRef.HasProxyAttribute())
         {
             fRefine = true;
         }
         tPOrObject = GetOrCreateProxy(idObj, proxy, fRefine);
     }
     TrackingServices.UnmarshaledObject(tPOrObject, objectRef);
     return tPOrObject;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:64,代码来源:RemotingServices.cs


注:本文中的System.Runtime.Remoting.ObjRef.IsWellKnown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。