示例#1
0
 private IOperationResult ComposeMemberGroups()
 {
     var result = new CompositeOperationResult();
       var roleMemberGroups = _container.RetrieveMemberGroups();
       var memberComposer = new MemberComposer(_targetType, _container);
       roleMemberGroups.ForEach(group => memberComposer.Compose(group));
       result.Slurp(memberComposer);
       return result;
 }
 private void ImplementPropertyAccessorMethods(PropertyDefinition implementedProperty, MemberComposer propertyAccessorComposer)
 {
     if (RoleProperty.GetMethod != null) {
     var getterRoleGroup = Container.ResolveGroup(Role, RoleProperty.GetMethod);
     implementedProperty.GetMethod = (MethodDefinition)propertyAccessorComposer.Compose(getterRoleGroup, _accessSpecifier);
       }
       if (RoleProperty.SetMethod != null) {
     var setterRoleGroup = Container.ResolveGroup(Role, RoleProperty.SetMethod);
     implementedProperty.SetMethod = (MethodDefinition)propertyAccessorComposer.Compose(setterRoleGroup, _accessSpecifier);
       }
 }
 private void ImplementEventAccessorMethods(EventDefinition implementedEvent, MemberComposer propertyAccessorComposer)
 {
     if (RoleEvent.AddMethod != null) {
     var addMethodRoleGroup = Container.ResolveGroup(Role, RoleEvent.AddMethod);
     implementedEvent.AddMethod = (MethodDefinition)propertyAccessorComposer.Compose(addMethodRoleGroup, _accessSpecifier);
       }
       if (RoleEvent.RemoveMethod != null) {
     var removeMethodRoleGroup = Container.ResolveGroup(Role, RoleEvent.RemoveMethod);
     implementedEvent.RemoveMethod = (MethodDefinition)propertyAccessorComposer.Compose(removeMethodRoleGroup, _accessSpecifier);
       }
       if (RoleEvent.InvokeMethod != null) {
     var invokeMethodRoleGroup = Container.ResolveGroup(Role, RoleEvent.InvokeMethod);
     implementedEvent.RemoveMethod = (MethodDefinition)propertyAccessorComposer.Compose(invokeMethodRoleGroup, _accessSpecifier);
       }
 }
        private EventDefinition ImplementEvent()
        {
            Tracer.TraceVerbose("Compose event: {0}", _name);

              var placeholder = ((EventDefinition)Group.Placeholder);

              var implementedEvent =
            placeholder ??
            new MemberResolver(Role, Module).ResolveEventDefinition(RoleEvent);

              if (placeholder == null) {
            TargetType.Events.Add(implementedEvent);
              }

              var eventAccessorComposer = new MemberComposer(TargetType, Container);
              ImplementEventAccessorMethods(implementedEvent, eventAccessorComposer);

              return implementedEvent;
        }
 private PropertyDefinition ImplementPropertyWithBackingField()
 {
     var implementedProperty = ImplementProperty();
       var propertyAccessorComposer = new MemberComposer(TargetType, Container);
       propertyAccessorComposer._backingField = CreateBackingFieldFor(implementedProperty);
       ImplementPropertyAccessorMethods(implementedProperty, propertyAccessorComposer);
       return implementedProperty;
 }
 private PropertyDefinition ImplementPropertyCallingCodeClass()
 {
     var implementedProperty = ImplementProperty();
       var propertyAccessorComposer = new MemberComposer(TargetType, Container);
       ImplementPropertyAccessorMethods(implementedProperty, propertyAccessorComposer);
       return implementedProperty;
 }