In order to return empty IEnumerable in csharp you can use static Empty<T>() method in Enumerable class.
Suppose i have custom class called Foo then,
Enumerable.Empty<Foo>();
In order to return empty IEnumerable in csharp you can use static Empty<T>() method in Enumerable class.
Suppose i have custom class called Foo then,
Enumerable.Empty<Foo>();
I have SPD work flow which associated with a list that derived from content type. Using my .net application which was written using SharePoint Client Object Model i update .list item.But in some instances my workflow corrupted by mentioning above error.As well as my workflow has configured to initiate when list item creation only.
Finally i figure out reason for this strange behavior
There is one instance in my application in which i create list item and then updates same item to particular state.Due to these two step happen in instantly my workflow getting failed.
Solution
As solution what i have done is to make sure properly workflow initiated or not by querying the workflow instance id.Once i confirmed it then i execute rest of the code.other wise my operation is sleep till workflow initiated.From the beginning of my work flow i saved workflow instance id as list item.
As follows you can get the workflow instance id,
public string GetWorkflowURL(string styleNo, int versionId)
{
/*Getting the update list item */
ListItem listItem = GetUpdateItem(styleNo, versionId);
ListColumns listColumns = new ListColumns();
return listItem != null
? (listItem[listColumns.WorkFlow] != null
? ((FieldUrlValue) (listItem[listColumns.WorkFlow])).Url
: string.Empty)
: string.Empty;
}
This work around has worked to me.
public static void PerformAction(Func<int,int,int> method,int x,int y) { int result=method.Invoke(x, y); }
Here my is my controller class
static void Main(string[] args) {
Func<int, int, int> addingFunc = (x, y) => (x + y); PerformAction(addingFunc , 5, 10); }
here i use same example without retuning the result,instead of that i write it in to a just Console.
public static void PerformAction(Action<int,int> method,int x,int y) { method.Invoke(x, y); } Here my is my controller class
static void Main(string[] args) { Action<int, int> addingAction = (x, y) => Console.WriteLine(x + y); PerformAction(addingAction, 5, 10); }
In normal behavior of WCF if you try to implement method overloading in WCF service contract it will throw the an InvaildOperationException once you invoke the service.
[OperationContract]
[FaultContract(typeof (ServiceException))]
BasicDataDTO[] RetrieveGenericData(EBasicDataType genericType, string descriptionPart);
[OperationContract]
[FaultContract(typeof (ServiceException))]
BasicDataDTO[] RetrieveGenericData(string styleNo, int versionId, EBasicDataType genericType, string descriptionPart);
In generally above statement will throw the InvaildOperationException.To overcome this problem you have to put OperationContractAttribute with Name Property.
[OperationContract(Name = "GetGenericData")]
[FaultContract(typeof (ServiceException))]
BasicDataDTO[] RetrieveGenericData(EBasicDataType genericType, string descriptionPart);
[OperationContract(Name = "GetAllgenericData")]
[FaultContract(typeof (ServiceException))]
BasicDataDTO[] RetrieveGenericData(string styleNo, int versionId, EBasicDataType genericType, string descriptionPart);
In Object Oriented aspect above code is correct ,WCF always generate proxy using the WSDL.The problem is WSDL does not support the concepts like inheritance and overloading.