/// <summary>
        /// Forces the regenerate the SPMetal designer file.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="properties">The properties for the SPMetal definition.</param>
        internal void ForceRegenerate(ISharePointProjectItem owner, SPMetalDefinitionProperties properties)
        {
            owner.Annotations.Remove <SPMetalDefinitionProperties>();
            owner.Annotations.Add <SPMetalDefinitionProperties>(properties);

            ProjectItem   dteItem = owner.Project.ProjectService.Convert <ISharePointProjectItemFile, ProjectItem>(owner.DefaultFile);
            VSProjectItem vp      = (VSProjectItem)dteItem.Object;

            vp.RunCustomTool();
        }
        /// <summary>
        /// Handles the ProjectItemPropertiesRequested event of the TypeDefinition control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.VisualStudio.SharePoint.SharePointProjectItemPropertiesRequestedEventArgs"/> instance containing the event data.</param>
        void TypeDefinition_ProjectItemPropertiesRequested(object sender, SharePointProjectItemPropertiesRequestedEventArgs e)
        {
            SPMetalDefinitionProperties properties = e.ProjectItem.Annotations.GetValue <SPMetalDefinitionProperties>();

            if (properties == null)
            {
                properties = new SPMetalDefinitionProperties(this, e.ProjectItem, e.ProjectItem.ExtensionData);
                e.ProjectItem.Annotations.Add <SPMetalDefinitionProperties>(properties);
            }
            e.PropertySources.Add(properties);
        }
Esempio n. 3
0
            /// <summary>
            /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
            /// </summary>
            /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that provides a format context.</param>
            /// <param name="value">An <see cref="T:System.Object"/> that specifies the type of array for which to get CKSProperties.</param>
            /// <param name="attributes">An array of type <see cref="T:System.Attribute"/> that is used as a filter.</param>
            /// <returns>
            /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"/> with the properties that are exposed for this data type, or null if there are no CKSProperties.
            /// </returns>
            public override PropertyDescriptorCollection GetProperties(
                ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                SPMetalDefinitionProperties  configProperties = (SPMetalDefinitionProperties)value;
                PropertyDescriptorCollection properties       = base.GetProperties(context, value, attributes);

                if (configProperties.Mode == SPMetalDefinitionSource.CurrentDeploymentSite)
                {
                    PropertyDescriptor urlDescriptor = properties["Url"];
                    properties.Remove(urlDescriptor);
                    properties.Add(new ReadOnlyPropertyDescriptor("Url", null)
                    {
                        InnerDescriptor   = urlDescriptor,
                        ReadOnlyEvaluator = p => true
                    });
                }
                return(properties);
            }