public MetadataMessages(SdkMessages messages)
 {
     Messages = new Dictionary<Guid, MetadataMessage>();
     foreach (var message in messages.MessageCollection)
     {
         Messages[message.Key] = new MetadataMessage(message.Value);
     }
 }
 internal OrganizationMetadata(EntityMetadata[] entities, OptionSetMetadataBase[] optionSets, SdkMessages messages)
 {
     Trace.TraceInformation("Entering {0}", new object[] {MethodBase.GetCurrentMethod().Name});
     _entities = entities;
     _optionSets = optionSets;
     _sdkMessages = messages;
     Trace.TraceInformation("Exiting {0}", new object[] {MethodBase.GetCurrentMethod().Name});
 }
Beispiel #3
0
 internal static MessagePagingInfo FromFetchResult(SdkMessages messages, string xml)
 {
     ResultSet resultSet;
     using (var reader = new StringReader(xml))
     {
         var serializer = new XmlSerializer(typeof (ResultSet), string.Empty);
         resultSet = serializer.Deserialize(reader) as ResultSet;
     }
     messages.Fill(resultSet);
     return MessagePagingInfo.FromResultSet(resultSet);
 }
 SdkMessages RetrieveSdkRequests(IOrganizationService service)
 {
     var fetchQuery = "<fetch distinct='true' version='1.0'>\r\n\t<entity name='sdkmessage'>\r\n\t\t<attribute name='name'/>\r\n\t\t<attribute name='isprivate'/>\r\n\t\t<attribute name='sdkmessageid'/>\r\n\t\t<link-entity name='sdkmessagepair' alias='sdkmessagepair' to='sdkmessageid' from='sdkmessageid' link-type='inner'>\r\n\t\t\t<filter>\r\n\t\t\t\t<condition alias='sdkmessagepair' attribute='endpoint' operator='eq' value='2011/Organization.svc' />\r\n\t\t\t</filter>\r\n\t\t\t<attribute name='sdkmessagepairid'/>\r\n\t\t\t<attribute name='namespace'/>\r\n\t\t\t<link-entity name='sdkmessagerequest' alias='sdkmessagerequest' to='sdkmessagepairid' from='sdkmessagepairid' link-type='outer'>\r\n\t\t\t\t<attribute name='sdkmessagerequestid'/>\r\n\t\t\t\t<attribute name='name'/>\r\n\t\t\t\t<link-entity name='sdkmessagerequestfield' alias='sdkmessagerequestfield' to='sdkmessagerequestid' from='sdkmessagerequestid' link-type='outer'>\r\n\t\t\t\t\t<attribute name='name'/>\r\n\t\t\t\t\t<attribute name='optional'/>\r\n\t\t\t\t\t<attribute name='position'/>\r\n\t\t\t\t\t<attribute name='publicname'/>\r\n\t\t\t\t\t<attribute name='clrparser'/>\r\n\t\t\t\t</link-entity>\r\n\t\t\t\t<link-entity name='sdkmessageresponse' alias='sdkmessageresponse' to='sdkmessagerequestid' from='sdkmessagerequestid' link-type='outer'>\r\n\t\t\t\t\t<attribute name='sdkmessageresponseid'/>\r\n\t\t\t\t\t<link-entity name='sdkmessageresponsefield' alias='sdkmessageresponsefield' to='sdkmessageresponseid' from='sdkmessageresponseid' link-type='outer'>\r\n\t\t\t\t\t\t<attribute name='publicname'/>\r\n\t\t\t\t\t\t<attribute name='value'/>\r\n\t\t\t\t\t\t<attribute name='clrformatter'/>\r\n\t\t\t\t\t\t<attribute name='name'/>\r\n\t\t\t\t\t\t<attribute name='position' />\r\n\t\t\t\t\t</link-entity>\r\n\t\t\t\t</link-entity>\r\n\t\t\t</link-entity>\r\n\t\t</link-entity>\r\n\t\t<link-entity name='sdkmessagefilter' alias='sdmessagefilter' to='sdkmessageid' from='sdkmessageid' link-type='inner'>\r\n\t\t\t<filter>\r\n\t\t\t\t<condition alias='sdmessagefilter' attribute='isvisible' operator='eq' value='1' />\r\n\t\t\t</filter>\r\n\t\t\t<attribute name='sdkmessagefilterid'/>\r\n\t\t\t<attribute name='primaryobjecttypecode'/>\r\n\t\t\t<attribute name='secondaryobjecttypecode'/>\r\n\t\t</link-entity>\r\n\t </entity>\r\n</fetch>";
     MessagePagingInfo info = null;
     var pageNumber = 1;
     var messages = new SdkMessages(null);
     var request = new OrganizationRequest("ExecuteFetch");
     while ((info == null) || info.HasMoreRecords)
     {
         var str2 = fetchQuery;
         if (info != null)
         {
             str2 = SetPagingCookie(fetchQuery, info.PagingCookig, pageNumber);
         }
         request.Parameters["FetchXml"] = str2;
         var response = service.Execute(request);
         info = SdkMessages.FromFetchResult(messages, (string) response.Results["FetchXmlResult"]);
         pageNumber++;
     }
     return messages;
 }
 IOrganizationMetadata CreateOrganizationMetadata(EntityMetadata[] entityMetadata, OptionSetMetadataBase[] optionSetMetadata, SdkMessages messages)
 {
     return new OrganizationMetadata(entityMetadata, optionSetMetadata, messages);
 }
 static CodeTypeDeclarationCollection BuildMessages(SdkMessages sdkMessages, ServiceProvider serviceProvider)
 {
     Trace.TraceInformation("Entering {0}", new object[] {MethodBase.GetCurrentMethod().Name});
     var declarations = new CodeTypeDeclarationCollection();
     foreach (var message in sdkMessages.MessageCollection.Values)
     {
         if (serviceProvider.CodeMessageFilterService.GenerateSdkMessage(message, serviceProvider))
         {
             declarations.AddRange(BuildMessage(message, serviceProvider));
         }
         else
         {
             Trace.TraceInformation("Skipping SDK Message {0} from being generated.", new object[] {message.Name});
         }
     }
     Trace.TraceInformation("Exiting {0}", new object[] {MethodBase.GetCurrentMethod().Name});
     return declarations;
 }