I have written a TMS plugin and extracting all the components present in the pages/bundles/structure groups sent in the translation job.
While performing these operations I am sure core service must be firing enormous queries to the DB which results in time out. The exact error whihc I am getting is the given below:
A database error occurred while executing Stored Procedure "EDA_ORG_ITEMS_READ".
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The wait operation timed out
Component: Tridion.ContentManager.CoreService Errorcode: 831
StackTrace Information Details: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() ...............
Can you please provide any pointer.
String bundleTCM = "";
String bundleLocation = ConfigurationLoader.GetAppSetting("bundleLocation");
String bundleTypeSchema = ConfigurationLoader.GetAppSetting("bundleTypeSchema");
VirtualFolderData bundle = (VirtualFolderData)client.GetDefaultData(ItemType.VirtualFolder, bundleLocation, new ReadOptions());
bundle.Configuration = "<Bundle xmlns=\"http://www.sdltridion.com/ContentManager/Bundle\"><Items /></Bundle>";
bundle.TypeSchema = new LinkToSchemaData { IdRef = bundleTypeSchema };
bundle.Title = title + " [" + string.Format("{0:yyyy-MM-dd_hh-mm}", DateTime.Now) + "]";
TcmUri publicationId = new TcmUri(bundleLocation);
List<String> componentIDs = new List<string>();
XDocument doc = XDocument.Parse(bundle.Configuration);
XNamespace xmlns = "http://www.sdltridion.com/ContentManager/Bundle";
XNamespace xlink = "http://www.w3.org/1999/xlink";
XElement newItemNode = null;
foreach (PageData page in pages)
{
UsedItemsFilterData filter = new UsedItemsFilterData();
filter.ItemTypes = new ItemType[] { ItemType.Component };
IdentifiableObjectData[] pageComponents = client.GetList(page.Id, filter);
// Get all the components included in the page and add ithem in the bundle
foreach (IdentifiableObjectData obj in pageComponents)
{
ComponentData component = (ComponentData)client.Read(obj.Id.ToString(), new ReadOptions { LoadFlags = LoadFlags.Expanded });
if (!componentIDs.Contains(component.Id))
{
componentIDs.Add(component.Id);
TcmUri itemUri = new TcmUri(component.Id);
TcmUri inContext = new TcmUri(itemUri.ItemId, itemUri.ItemType, publicationId.PublicationId);
if (client.IsExistingObject(inContext.ToString()))
{
newItemNode = new XElement(xmlns + "Item",
new XAttribute(XNamespace.Xmlns + "xlink", xlink),
new XAttribute(xlink + "href", inContext.ToString()));
doc.Root.Element(xmlns + "Items").Add(newItemNode);
}
// Add Linked Components
// addLinkedComponents(doc, xmlns, xlink, newItemNode, component, componentIDs, publicationId.PublicationId, client);
}
}
}
bundle.Configuration = doc.ToString();
client.Save(bundle, null);
bundleTCM = bundle.Id;
Thanks