private void OnObjectContainerGetted(IObjectContainerContext ctx) { if (ctx.Container != null) { return; } var objectKey = ctx.ObjectKey; if (!(objectKey is Type)) { return; } var objectType = (Type)objectKey; if (!objectType.IsDefined(typeof(RemotingServiceAttribute), true)) { return; } var attribute = objectType.GetCustomAttribute <RemotingServiceAttribute>(); //自动生成 IObjectContainer container = new SingletonObjectContainer(); container.Init(new ObjectDescription(objectType, new Hashtable { { typeof(RemotingServiceAttribute), attribute } }), this.ObjectBuilder); ctx.Namespace.AddObject(objectType, container); ctx.Container = container; }
protected virtual void OnObjectContainerGetted(IObjectContainerContext ctx) { this.ObjectContainerGetted?.Invoke(ctx); }