public static void InitMethods(this DbSetInfo dbSetInfo, Type serviceType) { System.Reflection.FieldInfo[] fields = typeof(OperationNames).GetFields(BindingFlags.Public | BindingFlags.Static); Array.ForEach(fields, (fl) => { if (!fl.IsSpecialName && fl.IsLiteral && !fl.IsInitOnly) { string operName = fl.GetValue(null).ToString(); string methodName = dbSetInfo.getOperationMethodName(operName); MethodInfo minfo = DbSetInfoEx.GetMethodInfo(serviceType, methodName); if (minfo != null) { switch (operName) { case OperationNames.REFRESH: dbSetInfo._refreshDataMethod = minfo; break; case OperationNames.CREATE: dbSetInfo._insertDataMethod = minfo; break; case OperationNames.UPDATE: dbSetInfo._updateDataMethod = minfo; break; case OperationNames.DELETE: dbSetInfo._deleteDataMethod = minfo; break; case OperationNames.VALIDATE: dbSetInfo._validateDataMethod = minfo; break; default: throw new DomainServiceException(string.Format("Invalid Operation name {0}", operName)); } } } }); }