Пример #1
0
        public IEnumerable <IConnector> Create(IMechanicsService _mechanics)
        {
            IEnumerable <IConnector> conn = null;

            if (right != null)
            {
                if (right.ContentItem.VersionRecord == null)
                {
                    right.ContentItem.ContentManager.Create(right);
                }
                conn = _mechanics.CreateConnector(left, right, ConnectorType, IgnorePermissions);
            }
            else
            {
                conn = _mechanics.CreateConnector(left, RightContentItemId, ConnectorType, IgnorePermissions);
            }
            if (transform != null)
            {
                foreach (var c in conn)
                {
                    transform(c);
                }
            }
            return(conn);
        }
Пример #2
0
 public IEnumerable<IConnector> Create(IMechanicsService _mechanics) {
     IEnumerable<IConnector> conn = null;
     if (right != null) {
         if (right.ContentItem.VersionRecord==null) {
             right.ContentItem.ContentManager.Create(right);
         }
         conn = _mechanics.CreateConnector(left, right, ConnectorType, IgnorePermissions);
     }
     else {
         conn = _mechanics.CreateConnector(left, RightContentItemId, ConnectorType, IgnorePermissions);
     }
     if (transform != null) {
         foreach (var c in conn) { 
             transform(c);
         }
     }
     return conn;
 }
Пример #3
0
        /// <summary>
        /// Loads right item by Id and creates the connector
        /// </summary>
        /// <param name="mechanics"></param>
        /// <param name="leftId"></param>
        /// <param name="rightId"></param>
        /// <param name="connectorType"></param>
        /// <returns></returns>
        public static IEnumerable <IConnector> CreateConnector(this IMechanicsService mechanics, IContent leftItem, int rightId, string connectorType, bool ignorePermissions = false)
        {
            var rightItem = mechanics.Services.ContentManager.Get(rightId);

            if (rightItem == null)
            {
                throw new Exception(String.Format("Failed to create connector: Right Item not found with Id: {0}", rightId));
            }
            return(mechanics.CreateConnector(leftItem, rightItem, connectorType, ignorePermissions));
        }