public static string GetOperationHelp(OperationSymbol symbol) { var type = OperationLogic.FindTypes(symbol).First(); var operationInfo = OperationLogic.GetOperationInfo(type, symbol); switch (operationInfo.OperationType) { case OperationType.Execute: return(HelpMessage.Call0Over1OfThe2.NiceToString().ForGenderAndNumber(type.GetGender()).FormatWith( operationInfo.OperationSymbol.NiceToString(), operationInfo.Lite.Value ? HelpMessage.TheDatabaseVersion.NiceToString() : HelpMessage.YourVersion.NiceToString(), type.NiceName())); case OperationType.Delete: return(HelpMessage.RemovesThe0FromTheDatabase.NiceToString(type.NiceName())); case OperationType.Constructor: return (HelpMessage.ConstructsANew0.NiceToString().ForGenderAndNumber(type.GetGender()).FormatWith(type.NiceName())); case OperationType.ConstructorFrom: return (HelpMessage.ConstructsANew0.NiceToString().ForGenderAndNumber(operationInfo.ReturnType.GetGender()).FormatWith(operationInfo.ReturnType.NiceName()) + " " + HelpMessage.From0OfThe1.NiceToString().ForGenderAndNumber(type.GetGender()).FormatWith(operationInfo.Lite.Value ? HelpMessage.TheDatabaseVersion.NiceToString() : HelpMessage.YourVersion.NiceToString(), type.NiceName())); case OperationType.ConstructorFromMany: return (HelpMessage.ConstructsANew0.NiceToString().ForGenderAndNumber(operationInfo.ReturnType.GetGender()).FormatWith(operationInfo.ReturnType.NiceName()) + " " + HelpMessage.FromMany0.NiceToString().ForGenderAndNumber(type.GetGender()).FormatWith(type.NicePluralName())); } return(""); }
public static OperationInfo TryGetOperationInfo(this ControllerBase controllerType, Type entityType) { OperationSymbol operationSymbol = controllerType.TryGetOperationKeyAsset(entityType); if (operationSymbol == null) { return(null); } return(OperationLogic.GetOperationInfo(entityType, operationSymbol)); }