本文整理汇总了C#中System.Runtime.Remoting.ObjRef类的典型用法代码示例。如果您正苦于以下问题:C# ObjRef类的具体用法?C# ObjRef怎么用?C# ObjRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjRef类属于System.Runtime.Remoting命名空间,在下文中一共展示了ObjRef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RemoteServer
/// <summary>
/// Initializes a new instance of the <see cref="RemoteServer"/> class.
/// </summary>
public RemoteServer()
{
RemoteObj = new RemoteObject();
serverchannel = new IpcChannel("localhost:15000");
ChannelServices.RegisterChannel(serverchannel, false);
ref1 = RemotingServices.Marshal(RemoteObj, "RemoteObject.rem");
Console.WriteLine("ObjRef1 URI: " + ref1.URI);
RemoteObj.ObjectSent += new ObjectSentEventHandler(OnObjectSent);
}
开发者ID:infomaniac50,项目名称:ScriptKey,代码行数:12,代码来源:RemoteServer.cs
示例2: UnmarshaledObject
public void UnmarshaledObject(
object obj,
ObjRef or
)
{
Console.WriteLine(AppDomain.CurrentDomain.FriendlyName+" Unmarshaled: "+obj.GetType().FullName);
}
开发者ID:emtees,项目名称:old-code,代码行数:7,代码来源:TrackingHandler.cs
示例3: RemotingHostServer
public RemotingHostServer(Machine machine, int port, string name)
: base(machine)
{
this.port = port;
this.name = name;
// TODO review this name, get machine name
this.hostname = "localhost";
// According to http://www.thinktecture.com/resourcearchive/net-remoting-faq/changes2003
// in order to have ObjRef accessible from client code
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = port;
TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
if (!registered)
{
ChannelServices.RegisterChannel(channel, false);
registered = true;
}
// end of "according"
// TODO review other options to publish an object
this.objref = RemotingServices.Marshal(this, name);
}
开发者ID:ajlopez,项目名称:AjTalk,代码行数:32,代码来源:RemotingHostServer.cs
示例4: InitialisiereRemotableObject
// stellt dieses Objekt via Remoting zur Verfügung
public void InitialisiereRemotableObject()
{
// melde dieses Objekt unter der gegebenen URL auf dem spezifierten Pfad an
_PortalLogikObjRef = RemotingServices.Marshal(
this,
this._Pfad,
((Object)this).GetType());
}
开发者ID:BackupTheBerlios,项目名称:pels-svn,代码行数:9,代码来源:Cap_PortalLogik.cs
示例5: UnmarshaledObject
// Notifies a handler that an object has been unmarshaled.
public void UnmarshaledObject(Object obj, ObjRef or)
{
if (obj.GetType() != typeof(AppDomain))
Trace.WriteLine(string.Format("Tangra Addins: Unmarshaled instance of {0} ({1} HashCode:{2})", or.TypeInfo != null ? or.TypeInfo.TypeName : obj.GetType().ToString(), or.URI != null ? or.URI.ToString() : "N/A", obj.GetHashCode().ToString()));
else
{
// Not interested in AppDomain marshalling
}
}
开发者ID:hpavlov,项目名称:tangra3,代码行数:10,代码来源:AddinTrackingHandler.cs
示例6: ObjRef
internal ObjRef (ObjRef o, bool unmarshalAsProxy) {
channel_info = o.channel_info;
uri = o.uri;
typeInfo = o.typeInfo;
envoyInfo = o.envoyInfo;
flags = o.flags;
if (unmarshalAsProxy) flags |= MarshalledObjectRef;
}
开发者ID:runefs,项目名称:Marvin,代码行数:9,代码来源:ObjRef.cs
示例7: DeserializeInTheCurrentDomain
internal ObjRef DeserializeInTheCurrentDomain (int domainId, byte[] tInfo)
{
string local_uri = string.Copy (this.uri);
ChannelInfo cinfo = new ChannelInfo (new CrossAppDomainData (domainId));
ObjRef res = new ObjRef (local_uri, cinfo);
IRemotingTypeInfo typeInfo = (IRemotingTypeInfo)CADSerializer.DeserializeObjectSafe (tInfo);
res.typeInfo = typeInfo;
return res;
}
开发者ID:Profit0004,项目名称:mono,代码行数:9,代码来源:ObjRef.cs
示例8: ObjRef
private ObjRef(ObjRef o)
{
this.uri = o.uri;
this.typeInfo = o.typeInfo;
this.envoyInfo = o.envoyInfo;
this.channelInfo = o.channelInfo;
this.objrefFlags = o.objrefFlags;
this.SetServerIdentity(o.GetServerIdentity());
this.SetDomainID(o.GetDomainID());
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:ObjRef.cs
示例9: MarshaledObject
// Notifies a handler that an object has been marshaled.
public void MarshaledObject(Object obj, ObjRef or)
{
if (obj.GetType() != typeof(AppDomain))
{
if (TraceSwitchAppDomainTracking.Enabled)
Trace.WriteLine(string.Format("OccuRec: Marshaled instance of {0} ({1} HashCode:{2})", or.TypeInfo != null ? or.TypeInfo.TypeName : obj.GetType().ToString(), or.URI != null ? or.URI.ToString() : "N/A", obj.GetHashCode().ToString()));
}
else
{
// Not interested in AppDomain marshalling
}
}
开发者ID:hpavlov,项目名称:occurec,代码行数:13,代码来源:TrackingHandler.cs
示例10: SyncProcessMessage
public IMessage SyncProcessMessage(IMessage msg)
{
IMethodMessage methodMessage = (IMethodMessage)msg;
if (methodMessage.MethodName == ".ctor")
{
IMethodReturnMessage retMsg = (IMethodReturnMessage)this.NextSink.SyncProcessMessage(msg);
_realObj = (ObjRef)retMsg.ReturnValue;
return retMsg;
}
AOPBaseClass obj = (AOPBaseClass)RemotingServices.Unmarshal(_realObj);
return obj.SyncProcessMessage(this.NextSink, msg);
}
开发者ID:jodli,项目名称:AOP,代码行数:12,代码来源:AOPSink.cs
示例11: SyncProcessMessage
public IMessage SyncProcessMessage(IMessage msg)
{
IMethodMessage methodMessage = (IMethodMessage)msg;
if (methodMessage.MethodName == ".ctor") {
IMethodReturnMessage ret = (IMethodReturnMessage)m_NextSink.SyncProcessMessage(msg);
realobject = (ObjRef)ret.ReturnValue;
return ret;
} else {
AOPBaseClass obj = (AOPBaseClass)RemotingServices.Unmarshal(realobject);
return obj.SyncProcessMessage(m_NextSink, msg);
}
}
开发者ID:liaoyu45,项目名称:LYCodes,代码行数:13,代码来源:AOPSink.cs
示例12: NotifyMarshaledObject
internal static void NotifyMarshaledObject(Object obj, ObjRef or)
{
ITrackingHandler[] handlers;
lock (_handlers.SyncRoot) {
if (_handlers.Count == 0) return;
handlers = (ITrackingHandler[]) _handlers.ToArray (typeof(ITrackingHandler));
}
for(int i = 0; i < handlers.Length; i++) {
handlers[i].MarshaledObject (obj, or);
}
}
开发者ID:jack-pappas,项目名称:mono,代码行数:13,代码来源:TrackingServices.cs
示例13: MarshaledObject
internal static void MarshaledObject(object obj, ObjRef or)
{
try
{
ITrackingHandler[] handlerArray = _Handlers;
for (int i = 0; i < _Size; i++)
{
handlerArray[i].MarshaledObject(obj, or);
}
}
catch
{
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:TrackingServices.cs
示例14: SyncProcessMessage
/// <summary>
/// Synchronously processes the given message.
/// </summary>
/// <param name="msg">The message to process.</param>
/// <returns>
/// A reply message in response to the request.
/// </returns>
/// <exception cref="T:System.Security.SecurityException">
/// The immediate caller makes the call through a reference to the interface and does not have infrastructure permission.
/// </exception>
public IMessage SyncProcessMessage(IMessage msg)
{
IMethodMessage methodMessage = (IMethodMessage)msg;
if (methodMessage.MethodName == ".ctor")
{
IMethodReturnMessage ret = (IMethodReturnMessage)_nextSink.SyncProcessMessage(msg);
_realObject = (ObjRef)ret.ReturnValue;
return ret;
}
else
{
AspectOrientedObject obj = (AspectOrientedObject)RemotingServices.Unmarshal(_realObject);
return obj.SyncProcessMessage(_nextSink, msg);
}
}
开发者ID:treytomes,项目名称:ILExperiments,代码行数:25,代码来源:AspectMessageSink.cs
示例15: CreateProxy
public override RealProxy CreateProxy(ObjRef objRef, Type serverType, Object serverObject, Context serverContext)
{
var proxy = new InterceptionRealProxy(serverType);
if (serverContext != null)
{
RealProxy.SetStubData(proxy, serverContext);
}
if ((serverType.IsMarshalByRef == false) && (serverContext == null))
{
throw new RemotingException("Bad Type for CreateProxy");
}
return (proxy);
}
开发者ID:rjperes,项目名称:DevelopmentWithADot.Interception,代码行数:16,代码来源:InterceptionProxyAttribute.cs
示例16: CreateProxy
public virtual RealProxy CreateProxy(ObjRef objRef, Type serverType, object serverObject, Context serverContext)
{
RemotingProxy rp = new RemotingProxy(serverType);
if (serverContext != null)
{
RealProxy.SetStubData(rp, serverContext.InternalContextID);
}
if ((objRef != null) && objRef.GetServerIdentity().IsAllocated)
{
rp.SetSrvInfo(objRef.GetServerIdentity(), objRef.GetDomainID());
}
rp.Initialized = true;
Type type = serverType;
if ((!type.IsContextful && !type.IsMarshalByRef) && (serverContext != null))
{
throw new RemotingException(Environment.GetResourceString("Remoting_Activation_MBR_ProxyAttribute"));
}
return rp;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:ProxyAttribute.cs
示例17: SyncProcessMessage
public IMessage SyncProcessMessage(IMessage msg)
{
var method = msg as IMethodMessage;
if (method.MethodName == ".ctor") {
var ret = nextSink.SyncProcessMessage(msg) as IMethodReturnMessage;
realobject = ret.ReturnValue as ObjRef;
return ret;
}
var validators = method.MethodBase.GetCustomAttributes(typeof(ValidationAttribute), false) as ValidationAttribute[];
if (validators != null) {
foreach (var validator in validators) {
validator.MethodMessage = method;
validator.Validate();
}
}
var bll = RemotingServices.Unmarshal(realobject) as WebBllBase;
bll.ProcessMessage(msg);
var retMsg = this.nextSink.SyncProcessMessage(msg);
return retMsg;
}
开发者ID:liaoyu45,项目名称:LYCodes,代码行数:20,代码来源:ValidationContextProperty.cs
示例18: MarshaledObject
public void MarshaledObject(object obj, ObjRef or)
{
Console.WriteLine("--- Marshaled Object " +
obj.GetType() + " ---");
Console.WriteLine("Object URI: " + or.URI);
object[] channelData = or.ChannelInfo.ChannelData;
foreach (object data in channelData)
{
ChannelDataStore dataStore = data as ChannelDataStore;
if (dataStore != null)
{
foreach (string uri in dataStore.ChannelUris)
{
Console.WriteLine("Channel URI: " + uri);
}
}
}
Console.WriteLine("---------");
Console.WriteLine();
}
开发者ID:alannet,项目名称:example,代码行数:20,代码来源:TrackingHandler.cs
示例19: MarshaledObject
public void MarshaledObject(object obj, ObjRef or)
{
object data = CallContext.GetData("ClientIp");
if ((data != null) && (or.ChannelInfo != null))
{
string ip = "";
string port = "";
this.SplitClientAddress(data.ToString(), out ip, out port);
for (int i = or.ChannelInfo.ChannelData.GetLowerBound(0); i <= or.ChannelInfo.ChannelData.GetUpperBound(0); i++)
{
if (or.ChannelInfo.ChannelData[i] is ChannelDataStore)
{
foreach (string str3 in ((ChannelDataStore) or.ChannelInfo.ChannelData[i]).ChannelUris)
{
ChannelDataStore store = new ChannelDataStore(this.GetClientAddressFromUri(str3, ip, port));
or.ChannelInfo.ChannelData[i] = store;
}
}
}
}
}
开发者ID:lexzh,项目名称:Myproject,代码行数:21,代码来源:IPTrackingHandler.cs
示例20: FindOrCreateIdentity
[System.Security.SecurityCritical] // auto-generated
internal static Identity FindOrCreateIdentity(
String objURI, String URL, ObjRef objectRef)
{
Identity idObj = null;
Contract.Assert(null != objURI,"null != objURI");
bool bWellKnown = (URL != null);
// Lookup the object in the identity table
// for well-known objects we user the URL
// as the hash-key (instead of just the objUri)
idObj = ResolveIdentity(bWellKnown ? URL : objURI);
if (bWellKnown &&
(idObj != null) &&
(idObj is ServerIdentity))
{
// We are trying to do a connect to a server wellknown object.
throw new RemotingException(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString(
"Remoting_WellKnown_CantDirectlyConnect"),
URL));
}
if (null == idObj)
{
// There is no entry for this uri in the IdTable.
Message.DebugOut("RemotingService::FindOrCreateIdentity: Creating Identity\n");
// This identity is being encountered for the first time.
// We have to do the following things
// (1) Create an identity object for the proxy
// (2) Add the identity to the identity table
// (3) Create a proxy for the object represented by the objref
// Create a new identity
// <EMAIL>GopalK:</EMAIL> Identity should get only one string that is used for everything
idObj = new Identity(objURI, URL);
// We need to guarantee that finally is not interrupted so that the lock is released.
// TableLock has a long path without reliability contract. To avoid adding contract on
// the path, we will use ReaderWriterLock directly.
ReaderWriterLock rwlock = TableLock;
bool takeAndRelease = !rwlock.IsWriterLockHeld;
RuntimeHelpers.PrepareConstrainedRegions();
try
{
// Add it to the identity table
if (takeAndRelease)
rwlock.AcquireWriterLock(INFINITE);
// SetIdentity will give the correct Id if we ----d
// between the ResolveIdentity call above and now.
// (we are unmarshaling, and the server should guarantee
// that the uri is unique, so we will use an existing identity
// in case of a ----)
idObj = SetIdentity(idObj, null, DuplicateIdentityOption.UseExisting);
idObj.RaceSetObjRef(objectRef);
}
finally
{
if (takeAndRelease && rwlock.IsWriterLockHeld)
{
rwlock.ReleaseWriterLock();
}
}
}
else
{
Message.DebugOut("RemotingService::FindOrCreateIdentity: Found Identity!\n");
}
Contract.Assert(null != idObj,"null != idObj");
return idObj;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:78,代码来源:IdentityHolder.cs
注:本文中的System.Runtime.Remoting.ObjRef类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论