private static void Create(this Properties properties, string name, SoType soType, MetaData metaData = null)
        {
            if (properties.Contains(name))
            {
                return;
            }

            if (metaData == null)
            {
                metaData = new MetaData
                {
                    DisplayName = name,
                    Description = ""
                }
            }
            ;

            properties.Create(new Property
            {
                Name     = name,
                Type     = GetType(soType),
                SoType   = soType,
                MetaData = metaData,
                Value    = null
            });
        }
예제 #2
0
        public override List <ServiceObject> DescribeServiceObjects()
        {
            List <ServiceObject> sos = new List <ServiceObject>();


            foreach (KeyValuePair <string, string> query in ADOSMOQueries)
            {
                ServiceObject so = Helper.CreateServiceObject(query.Key, "ADO.NET SMO query.");
                so.Properties.Add(Helper.CreateProperty(Constants.SOProperties.ExportToExcel.FileName, SoType.Text, "The name of generated file"));
                so.Properties.Add(Helper.CreateFileProperty(Constants.SOProperties.ExportToExcel.ExcelFile, "The excel file that will be generated"));

                /* To do: parsing properties. Without that queries contains WHERE and @parameters will not work on initialization level (no properties created).
                 * The queries like this do not work at the moment:
                 * SELECT * FROM table WHERE type = @type
                 * There is no custom error message, only system one, because
                 * it's impossible to found if there are @parameters used within WHERE clause, because these queries will work:
                 * SELECT * FROM table WHERE type='Type1' HAVING (id = @id)
                 */



                Dictionary <string, string> props = new Dictionary <string, string>();
                foreach (Match match in Regex.Matches(query.Value, "\\@\\w+"))
                {
                    if (!props.ContainsKey(match.ToString()))
                    {
                        props.Add(match.ToString(), "0");
                    }
                }

                DataTable results = GetSchema(query.Value, props);

                Method soMethod = Helper.CreateMethod(Constants.Methods.ADOSMOQuery.ListQueryData, "Returns result of SMO query.", MethodType.List);
                soMethod.MetaData.AddServiceElement("Query", query.Value);
                foreach (DataColumn col in results.Columns)
                {
                    string name = col.ColumnName;
                    SoType type = MapHelper.GetSoTypeByType(col.DataType);
                    so.Properties.Add(Helper.CreateProperty(name, type, name));
                    soMethod.InputProperties.Add(Helper.CreateProperty(name, type, name));
                    soMethod.ReturnProperties.Add(Helper.CreateProperty(name, type, name));
                }
                so.Methods.Add(soMethod);

                Method mExcelFromADOQuery = Helper.CreateMethod(Constants.Methods.ADOSMOQuery.ExcelFromADOQuery, "Generate an Excel file based on ADO query", MethodType.Read);
                mExcelFromADOQuery.MetaData.AddServiceElement("Query", query.Value);
                mExcelFromADOQuery.ReturnProperties.Add(Constants.SOProperties.ExportToExcel.ExcelFile);
                mExcelFromADOQuery.InputProperties.Add(Constants.SOProperties.ExportToExcel.FileName);
                mExcelFromADOQuery.Validation.RequiredProperties.Add(Constants.SOProperties.ExportToExcel.FileName);
                so.Methods.Add(mExcelFromADOQuery);


                sos.Add(so);
            }

            return(sos);
        }
        public static void Create(this Properties properties, string name, SoType soType, string displayName = "")
        {
            var meta = new MetaData
            {
                DisplayName = displayName,
                Description = ""
            };

            Create(properties, name, soType, meta);
        }
 public void AddProperty(string name,string displayName,string description, string trueType,SoType k2Type)
 {
     SchemaProperty prop = new SchemaProperty();
     prop.Name=name;
     prop.DisplayName = displayName;
     prop.Description = description;
     prop.TrueType = trueType;
     prop.K2Type = k2Type;
     SchemaProperties.Add(prop);
 }
        public static Property CreateProperty(string name, string displayName, string description, string type, SoType soType)
        {
            Property proprty = new Property();
            proprty.Name = name;
            proprty.MetaData.DisplayName = displayName;
            proprty.MetaData.Description = description;
            proprty.Type = type;
            proprty.SoType = soType;

            return proprty;
        }
예제 #6
0
        public static Property CreateProperty(string name, string description, SoType type)
        {
            Property property = new Property
            {
                Name     = name,
                SoType   = type,
                Type     = MapHelper.GetTypeBySoType(type),
                MetaData = new MetaData(name, description)
            };

            return(property);
        }
        public ServiceObjectBuilder CreateProperty(string name, string description, SoType soType)
        {
            var property = new Property
            {
                Name     = name,
                SoType   = soType,
                Type     = MapHelper.GetTypeBySoType(soType),
                MetaData = new MetaData(name, description)
            };

            so.Properties.Add(property);
            return(this);
        }
예제 #8
0
        public static MethodParameter CreateParameter(string name, SoType soType, bool isRequired)
        {
            MethodParameter methodParam = new MethodParameter
            {
                Name       = name,
                IsRequired = isRequired,
                MetaData   = new MetaData
                {
                    DisplayName = name
                },
                SoType = soType,
                Type   = MapHelper.GetTypeBySoType(soType)
            };

            return(methodParam);
        }
예제 #9
0
 public static MethodParameter CreateParameter(string name, SoType soType, bool isRequired, string description)
 {
     MethodParameter methodParam = new MethodParameter
     {
         Name = name,
         IsRequired = isRequired,
         MetaData = new MetaData
         {
             Description = description,
             DisplayName = AddSpaceBeforeCaptialLetter(name)
         },
         SoType = soType,
         Type = Convert.ToString(soType)
     };
     return methodParam;
 }
예제 #10
0
        private Property CreateFieldProperty(string nameSuffix, SoType soType, Field fd, bool readOnly)
        {
            string   displayName  = string.Format("{0} ({1})", fd.Title, nameSuffix);
            string   internalName = string.Concat(fd.InternalName, nameSuffix);
            Property prop         = Helper.CreateSpecificProperty(internalName, displayName, fd.Description, soType);

            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Hidden, fd.Hidden);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Title, fd.Title);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.InternalName, fd.InternalName);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Id, fd.Id);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.ReadOnly, readOnly);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Required, fd.Required);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.FieldTypeKind, fd.FieldTypeKind);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.SPFieldType, fd.TypeAsString);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Internal, false);
            return(prop);
        }
        public ServiceObjectMethodBuilder AddParameter(string name, SoType soType, bool isRequired = false)
        {
            var methodParam = new MethodParameter
            {
                Name       = name,
                IsRequired = isRequired,
                MetaData   = new MetaData
                {
                    DisplayName = name
                },
                SoType = soType,
                Type   = MapHelper.GetTypeBySoType(soType)
            };

            method.MethodParameters.Create(methodParam);
            return(this);
        }
예제 #12
0
        public static MethodParameter CreateParameter(string name, SoType soType, bool isRequired, string description)
        {
            MethodParameter methodParam = new MethodParameter
            {
                Name       = name,
                IsRequired = isRequired,
                MetaData   = new MetaData
                {
                    Description = description,
                    DisplayName = AddSpaceBeforeCaptialLetter(name)
                },
                SoType = soType,
                Type   = Convert.ToString(soType)
            };

            return(methodParam);
        }
        public static string GetType(SoType type)
        {
            switch (type)
            {
            case SoType.AutoGuid:
            case SoType.Guid:
                return(typeof(Guid).ToString());

            case SoType.Autonumber:
            case SoType.Number:
                return(typeof(int).ToString());

            case SoType.Decimal:
                return(typeof(decimal).ToString());

            case SoType.Default:
            case SoType.Memo:
            case SoType.Text:
                return(typeof(string).ToString());

            case SoType.Date:
            case SoType.DateTime:
                return(typeof(DateTime).ToString());

            case SoType.Time:
                return(typeof(TimeSpan).ToString());

            case SoType.YesNo:
                return(typeof(bool).ToString());

            case SoType.File:
                return(typeof(string).ToString());

            case SoType.HyperLink:
            case SoType.Image:
            case SoType.MultiValue:
            case SoType.Xml:
            default:
                throw new ArgumentOutOfRangeException(nameof(type), $"Unknown mapping for {type}");
            }
        }
예제 #14
0
 /// <summary>
 /// Create an instance of a Service Object property
 /// This method allows you to set the displayname specifically.
 /// </summary>
 /// <param name="name">DisplayName of the property</param>
 /// <param name="displayName">The displayname to use.</param>
 /// <param name="description">A short description.</param>
 /// <param name="type">SMO Type of the property.</param>
 /// <returns>The property</returns>
 public static Property CreateSpecificProperty(string name, string displayName, string description, SoType type)
 {
     Property property = new Property();
     property.Name = name;
     property.SoType = type;
     property.Type = MapHelper.GetTypeBySoType(type);
     property.MetaData.DisplayName = displayName;
     property.MetaData.Description = description;
     return property;
 }
예제 #15
0
        /// <summary>
        /// Returns the SoType by its string value - Text/YesNo/Memo etc.
        /// </summary>
        /// <param name="name">Name of the SoType value</param>
        /// <returns></returns>
        public static SoType GetSoTypeByName(string name)
        {
            SoType soType = (SoType)Enum.Parse(typeof(SoType), name);

            return(soType);
        }
예제 #16
0
 public static Property CreateProperty(string name, string description, SoType type)
 {
     return(CreateSpecificProperty(name, AddSpaceBeforeCaptialLetter(name), description, type));
 }
예제 #17
0
 /// <summary>
 /// Retrieve the .NET Type (typeof(Type).toString()) for a given SOType.
 /// </summary>
 /// <param name="soType">the SOType</param>
 /// <returns>A typeof(T).toString() for the given SOType.</returns>
 public static string GetTypeBySoType(SoType soType)
 {
     return soType2SystemTypeMapping[soType];
 }
예제 #18
0
 /// <summary>
 /// See <see cref="CreateSpecificProperty"/>.
 /// This method however simply uses AddSpaceBeforeCapitalLetter(name) for it's displayname.
 /// </summary>
 public static Property CreateProperty(string name, SoType type, string description)
 {
     return CreateSpecificProperty(name, AddSpaceBeforeCaptialLetter(name), description, type);
 }
예제 #19
0
        //SPList is configured just to create service object of SP Lists
        public override List <ServiceObject> DescribeServiceObjects()
        {
            List <ServiceObject> SOs = new List <ServiceObject>();

            using (ClientContext context = InitializeContext(base.SiteURL))
            {
                Web            spWeb = context.Web;
                ListCollection lists = spWeb.Lists;
                context.Load(lists);

                context.ExecuteQuery();
                foreach (List list in lists)
                {
                    if (list.Hidden == false || (list.Hidden && base.IncludeHiddenLists))
                    {
                        ServiceObject so = Helper.CreateServiceObject(list.Title, list.Title, list.Description);

                        so.MetaData.DisplayName = list.Title;
                        so.MetaData.Description = list.Description;
                        if (list.BaseType == BaseType.DocumentLibrary)
                        {
                            so.MetaData.ServiceProperties.Add(Constants.InternalProperties.ServiceFolder, "Document Libraries");
                        }
                        else
                        {
                            so.MetaData.ServiceProperties.Add(Constants.InternalProperties.ServiceFolder, "List Items");
                        }

                        so.MetaData.ServiceProperties.Add(Constants.InternalProperties.ListId, list.Id);
                        so.MetaData.ServiceProperties.Add(Constants.InternalProperties.ListTitle, list.Title);
                        so.MetaData.ServiceProperties.Add(Constants.InternalProperties.IsFolderEnabled, list.EnableFolderCreation);
                        so.MetaData.ServiceProperties.Add(Constants.InternalProperties.ListBaseType, list.BaseType);


                        FieldCollection fields = list.Fields;
                        context.Load(fields);
                        context.ExecuteQuery();
                        foreach (Field f in fields)
                        {
                            if (f.Hidden == false || (f.Hidden == true && base.IncludeHiddenFields))
                            {
                                // We'll use InternalName as the system name and Title as the display name.
                                // See http://blogs.perficient.com/microsoft/2009/04/static-name-vs-internal-name-vs-display-name-in-sharepoint/ for some background

                                // Some fields have no title, so then we just take the internalname.
                                string fieldTitle = f.Title;
                                if (string.IsNullOrEmpty(fieldTitle))
                                {
                                    fieldTitle = f.InternalName;
                                }

                                // Because the field title can be duplicate, we see if it already exists.
                                // If it does, we change the displayname of both existing and newly found property to something unique.
                                // This behaviour can also be forced by the Show Internal Names option.

                                Property existingProp = GetExistingProperty(so, fieldTitle);
                                string   displayName  = fieldTitle;
                                if (ShowInternalNames)
                                {
                                    displayName = string.Format("{0} ({1})", fieldTitle, f.InternalName);
                                }

                                if (existingProp != null)
                                {
                                    existingProp.MetaData.DisplayName = string.Format("{0} ({1})",
                                                                                      existingProp.MetaData.GetServiceElement <string>(Constants.InternalProperties.Title),
                                                                                      existingProp.MetaData.GetServiceElement <string>(Constants.InternalProperties.InternalName));
                                    displayName = string.Format("{0} ({1})", fieldTitle, f.InternalName);
                                }

                                AddFieldProperty(so, f);
                                FieldType _fieldtype; //We will find the Fieldtype from the MapHelper class (To get the correctoutput for field type Calculated)

                                SoType   soType = MapHelper.SPTypeField(f, out _fieldtype);
                                Property prop   = Helper.CreateSpecificProperty(f.InternalName, displayName, f.Description, soType);

                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Hidden, f.Hidden);
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Title, fieldTitle);
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.InternalName, f.InternalName);
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Id, f.Id);
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.ReadOnly, AssignReadonly(f));
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Required, f.Required);
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.FieldTypeKind, _fieldtype);
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.SPFieldType, f.TypeAsString);
                                prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Internal, false);
                                so.Properties.Add(prop);
                            }
                        }

                        so.Properties.Add(NewProperty(Constants.SOProperties.DestinationURL, Constants.SOProperties.DestinationURL_DisplayName, true, SoType.Text, "The destination URL"));
                        so.Properties.Add(NewProperty(Constants.SOProperties.DestinationListTitle, Constants.SOProperties.DestinationListTitle_DisplayName, true, SoType.Text, "The system name of the list"));
                        so.Properties.Add(NewProperty(Constants.SOProperties.DestinationFolder, Constants.SOProperties.DestinationFolder_DisplayName, true, SoType.Text, "The foldername to apply this operation to"));
                        so.Properties.Add(NewProperty(Constants.SOProperties.FolderName, Constants.SOProperties.FolderName, true, SoType.Text, "The foldername to apply this operation to"));
                        so.Properties.Add(NewProperty(Constants.SOProperties.Recursively, Constants.SOProperties.Recursively, true, SoType.YesNo, "Recursively do this operation"));


                        AddGetByIdMethod(so);
                        AddCreateMethod(so);
                        AddDeleteMethod(so);
                        AddGetListMethod(so);
                        AddUpdateMethod(so);
                        if (so.IsSPFolderEnabled())
                        {
                            AddCreateFolderMethod(so);
                            AddDeleteFolderMethod(so);
                        }

                        //Non library methods
                        if (!so.IsDocumentLibrary())
                        {
                            AddMoveListItemMethod(so);
                            AddCopyListItemMethod(so);
                        }

                        SOs.Add(so);
                    }
                }

                return(SOs);
            }
        }
 /// <summary>
 /// Creates an instance of a Service Object property
 /// </summary>
 /// <param name="name">Name of the property</param>
 /// <param name="type">Service Object Type</param>
 /// <param name="description">A nice description.</param>
 /// <returns>The property you wanted to create.</returns>
 private Property CreateProperty(string name, SoType type, string description)
 {
     Property property = new Property();
     property.Name = name;
     property.SoType = type;
     property.MetaData.DisplayName = name;
     property.MetaData.Description = description;
     return property;
 }
        private static SoType GetSOType(string type)
        {
            SoType soType = SoType.Text;

            switch (type.ToLower())
            {
            case "autoguid":
                soType = SoType.AutoGuid;
                break;

            case "autonumber":
                soType = SoType.Autonumber;
                break;

            case "datetime":
                soType = SoType.DateTime;
                break;

            case "decimal":
                soType = SoType.Decimal;
                break;

            case "default":
                soType = SoType.Default;
                break;

            case "file":
                soType = SoType.File;
                break;

            case "guid":
                soType = SoType.Guid;
                break;

            case "hyperlink":
                soType = SoType.HyperLink;
                break;

            case "image":
                soType = SoType.Image;
                break;

            case "memo":
                soType = SoType.Memo;
                break;

            case "multivalue":
                soType = SoType.MultiValue;
                break;

            case "number":
                soType = SoType.Number;
                break;

            case "text":
                soType = SoType.Text;
                break;

            case "xml":
                soType = SoType.Xml;
                break;

            case "yesno":
                soType = SoType.YesNo;
                break;
            }
            return(soType);
        }
예제 #22
0
        public override List <ServiceObject> DescribeServiceObjects()
        {
            List <ServiceObject> SOs = new List <ServiceObject>();

            using (ClientContext context = InitializeContext(base.SiteURL))
            {
                Web            spWeb = context.Web;
                ListCollection lists = spWeb.Lists;
                context.Load(lists);
                context.ExecuteQuery();
                //Making this dummy call to load the Micorsoft.Sharepoint.Client.Taxanomy assembly (https://blogs.msdn.microsoft.com/boodablog/2014/07/04/taxonomy-fields-return-as-dictionaries-using-the-client-objcet-model-in-sharepoint-2013/)
                TaxonomyItem dummy = new TaxonomyItem(context, null);
                foreach (List list in lists)
                {
                    if (list.Hidden == false || (list.Hidden && base.IncludeHiddenLists))
                    {
                        if (list.BaseType == BaseType.DocumentLibrary)
                        {
                            context.Load(list.ContentTypes);
                            context.ExecuteQuery();
                        }

                        ServiceObject so = Helper.CreateServiceObject(list.Title, list.Title, list.Description);

                        so.MetaData.DisplayName = list.Title;
                        so.MetaData.Description = list.Description;
                        if (list.BaseType == BaseType.DocumentLibrary)
                        {
                            so.MetaData.AddServiceElement(Constants.InternalProperties.ServiceFolder, "Document Libraries");
                        }
                        else
                        {
                            so.MetaData.AddServiceElement(Constants.InternalProperties.ServiceFolder, "List Items");
                        }

                        so.MetaData.AddServiceElement(Constants.InternalProperties.ListTitle, list.Title);
                        so.MetaData.AddServiceElement(Constants.InternalProperties.IsFolderEnabled, list.EnableFolderCreation);
                        so.MetaData.AddServiceElement(Constants.InternalProperties.ListBaseType, list.BaseType);
                        if (list.BaseType == BaseType.DocumentLibrary && GetDocumentSetContentType(list.ContentTypes) != null)
                        {
                            so.MetaData.AddServiceElement(Constants.InternalProperties.IsListDocumentSet, true);
                        }
                        else
                        {
                            so.MetaData.AddServiceElement(Constants.InternalProperties.IsListDocumentSet, false);
                        }


                        FieldCollection fields = list.Fields;
                        context.Load(fields);
                        context.ExecuteQuery();
                        foreach (Field f in fields)
                        {
                            if (f.Hidden == false || (f.Hidden == true && base.IncludeHiddenFields))
                            {
                                // We'll use InternalName as the system name and Title as the display name.
                                // See http://blogs.perficient.com/microsoft/2009/04/static-name-vs-internal-name-vs-display-name-in-sharepoint/ for some background

                                // Some fields have no title, so then we just take the internalname.
                                string fieldTitle = f.Title;
                                if (string.IsNullOrEmpty(fieldTitle))
                                {
                                    fieldTitle = f.InternalName;
                                }

                                // Because the field title can be duplicate, we see if it already exists.
                                // If it does, we change the displayname of both existing and newly found property to something unique.
                                // This behaviour can also be forced by the Show Internal Names option.

                                Property existingProp = GetExistingProperty(so, fieldTitle);
                                string   displayName  = fieldTitle;
                                if (ShowInternalNames)
                                {
                                    displayName = string.Format("{0} ({1})", fieldTitle, f.InternalName);
                                }

                                if (existingProp != null)
                                {
                                    existingProp.MetaData.DisplayName = string.Format("{0} ({1})",
                                                                                      existingProp.MetaData.GetServiceElement <string>(Constants.InternalProperties.Title),
                                                                                      existingProp.MetaData.GetServiceElement <string>(Constants.InternalProperties.InternalName));
                                    displayName = string.Format("{0} ({1})", fieldTitle, f.InternalName);
                                }

                                AddFieldProperty(so, f);
                                FieldType _fieldtype; //We will find the Fieldtype from the MapHelper class (To get the correctoutput for field type Calculated)

                                SoType   soType = MapHelper.SPTypeField(f, out _fieldtype);
                                Property prop   = Helper.CreateSpecificProperty(f.InternalName, displayName, f.Description, soType);

                                prop.MetaData.AddServiceElement(Constants.InternalProperties.Hidden, f.Hidden);
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.Title, fieldTitle);
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.InternalName, f.InternalName);
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.Id, f.Id);
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.ReadOnly, AssignReadonly(f));
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.Required, f.Required);
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.FieldTypeKind, _fieldtype);
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.SPFieldType, f.TypeAsString);
                                prop.MetaData.AddServiceElement(Constants.InternalProperties.Internal, false);
                                so.Properties.Add(prop);
                            }
                        }

                        AddInputServiceObjectPropertie(so);

                        AddServiceObjectMethods(so);

                        SOs.Add(so);
                    }
                }

                ServiceObject ctSo = Helper.CreateServiceObject("ContentTypes", "Content Types", "Manage the collection of content types, which enables consistent handling of content across sites.");

                ctSo.MetaData.DisplayName = "Content Types";
                ctSo.MetaData.Description = "Manage the collection of content types, which enables consistent handling of content across sites.";
                ctSo.MetaData.AddServiceElement(Constants.InternalProperties.ServiceFolder, "Management");

                ctSo.Properties.Add(Helper.CreateSpecificProperty(Constants.SOProperties.ContentTypeName, "Name", "Name", SoType.Text));
                //so.Properties.Add(Helper.CreateSpecificProperty("SiteURL", "Site URL", "Site URL", SoType.Text));
                ctSo.Properties.Add(Helper.CreateSpecificProperty(Constants.SOProperties.ContentTypeGroup, "Group", "Group", SoType.Text));
                ctSo.Properties.Add(Helper.CreateSpecificProperty(Constants.SOProperties.ContentTypeReadOnly, "ReadOnly", "ReadOnly", SoType.YesNo));
                ctSo.Properties.Add(Helper.CreateSpecificProperty(Constants.SOProperties.ContentTypeHidden, "Hidden", "Hidden", SoType.Text));
                ctSo.Properties.Add(Helper.CreateSpecificProperty(Constants.SOProperties.ContentTypeCount, "Count", "Count", SoType.Number));
                ctSo.Properties.Add(Helper.CreateSpecificProperty(Constants.SOProperties.ContentTypeID, "Content Type ID", "Content Type ID", SoType.Text));

                AddContentTypeServiceObjectMethods(ctSo);

                SOs.Add(ctSo);

                return(SOs);
            }
        }
예제 #23
0
        private Property NewProperty(string internalName, string DisplayName, bool internalProp, SoType soType, string description)
        {
            Property prop = Helper.CreateSpecificProperty(internalName, DisplayName, description, soType);

            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.InternalName, internalName);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Title, DisplayName);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.Internal, internalProp);
            prop.MetaData.ServiceProperties.Add(Constants.InternalProperties.ReadOnly, false);
            return(prop);
        }
예제 #24
0
        public void AddProperty(string name, string displayName, string description, string trueType, SoType k2Type)
        {
            SchemaProperty prop = new SchemaProperty();

            prop.Name        = name;
            prop.DisplayName = displayName;
            prop.Description = description;
            prop.TrueType    = trueType;
            prop.K2Type      = k2Type;
            SchemaProperties.Add(prop);
        }
        public static Property CreateProperty(string name, string displayName, string description, string type, SoType soType)
        {
            Property proprty = new Property();

            proprty.Name = name;
            proprty.MetaData.DisplayName = displayName;
            proprty.MetaData.Description = description;
            proprty.Type   = type;
            proprty.SoType = soType;

            return(proprty);
        }
예제 #26
0
 /// <summary>
 /// Retrieve the .NET Type (typeof(Type).toString()) for a given SOType.
 /// </summary>
 /// <param name="soType">the SOType</param>
 /// <returns>A typeof(T).toString() for the given SOType.</returns>
 public static string GetTypeBySoType(SoType soType)
 {
     return(soType2SystemTypeMapping[soType]);
 }
예제 #27
0
 public static Property CreateProperty(string name, string description, SoType type)
 {
     return(CreateSpecificProperty(name, name, description, type));
 }
예제 #28
0
 /// <summary>
 /// Create an instance of a Service Object property
 /// This method allows you to set the displayname specifically.
 /// </summary>
 /// <param name="name">DisplayName of the property</param>
 /// <param name="displayName">The displayname to use.</param>
 /// <param name="description">A short description.</param>
 /// <param name="type">SMO Type of the property.</param>
 /// <returns>The property</returns>
 public static Property CreateSpecificProperty(string name, string displayName, string description, SoType type)
 {
     Property property = new Property
     {
         Name = name,
         SoType = type,
         Type = MapHelper.GetTypeBySoType(type),
         MetaData = new MetaData(displayName, description)
     };
     return property;
 }