|
My manager has asked me to use Restful service in my MVC application.I would like to know whether it has any advantages if we use in MVC application.
|
|
|
|
|
If he's told you to use it, then why bother debating?
Yes, REST is very useful - the new WCF RESTful services are a thing of beauty.
|
|
|
|
|
Its not about debating...I would like to know the advantages..thats it..
Thanks for your response
|
|
|
|
|
have a read[^] of this article. It explains the "whys and wherefores" pretty well.
|
|
|
|
|
harinit wrote: My manager has asked me to use Restful service in my MVC application.I would like to know whether it has any advantages if we use in MVC application.
Well based on that statement I would guess that there is no advantage.
Now it could be that your manager is smart, does a lot of research, does a lot of business analysis and then hands down decisions based on that to those under him/her without one mention of why a particular choice was made.
That wouldn't really reflect well on that persons ability to manage however.
But there is certainly a chance that it is just the buzzword of the week.
|
|
|
|
|
Hello There,
I have a winform application in Visual Studio 2010 and within a class I have a shared function with the following code
Public Shared Function simplestFunctionEver() as Integer
Dim myInteger1 As Integer = 1, myInteger2 As Integer = 2
simplestFunctionEver = myInteger1 + myInteger2
End Function
While debugging or otherwise, How can I test this function in Visual Studio 2010
Regards & Thanks in advance to users who reply
Farooq
|
|
|
|
|
Why would you want to, it doesn't do anything. Testing a method that takes in no arguments and returns nothing while also not changing or calculating anything external from the method is pointless.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Thanks for replying. The objective of my question was not the function but the method on how one can do this in Visual Studio 2010. I can use the same function to do complex formatting and addition of time by converting it to text etc and then wishing to see what the result would look like is a legit question
Regards
|
|
|
|
|
Marcus Kramer wrote: and returns nothing
Assigning a value to the functions' name is an antique syntax for returning that value.
Bastard Programmer from Hell
|
|
|
|
|
You could:
- single-step the code (not my favorite)
- exercise the code by having it called, any way you like
- execute unit tests (see NUnit)
- have an external company validate your implementation against your requirement specifications
- integrate it in a bigger app and observe (and maybe wonder why and how it is failing).
|
|
|
|
|
You can use the VSTS test project of VS2010 to create and execute to verify
or call this shared function via some other method.
|
|
|
|
|
Hello There,
Thanks for replying. Can you please clarify or guide me as to what VSTS Project is and how exactly can I call this type of function in there
Regards & Thanks
|
|
|
|
|
|
Member 3357336 wrote: While debugging or otherwise, How can I test this function in Visual Studio 2010
You can only debug one thing at a time. What does "test" mean here? You could add a watch to show it's return value during debugging
Bastard Programmer from Hell
|
|
|
|
|
Thanks for replying. "Test" simply means that I want to call this function and debug it's guts. Please note that users in this forum are taking this function literally. It's not the attributes of the function I am interested in but the way this could be debugged in VS2010. I could have a very "Generic", (shared) extremely lengthy format or compute function that I want to debug
I am still not sure on how to do this so please help
Regards
P.s. I really don't want to call this function while executing my complete program and calling with a button or anything similar. Simply go to a screen call the function and be able to debug it
|
|
|
|
|
The accepted way to test functions is to write unit tests, which you can call using test harnesses. There are whole books out there on the subject; what you really want to look at is unit testing c# and test driven development.
|
|
|
|
|
Thanks. This is exactly what I wanted to know. I simply created a unit test and that did it for me
Regards & Thanks to all who replied
|
|
|
|
|
You're welcome. Glad to be of service.
|
|
|
|
|
I have a DLL written in Visual C++ 6.0. I have a MFC test application which calls this DLL and it works fine. I also have a .NET C# WinForms test app which calls this DLL. I am importing the DLL and calling it successfully. I can see that the DLL is called correctly and all parameters are passed successfully. The DLL works for a time and then fails when trying to create a COM component by calling CoCreateInstance. This fails with an Access Violation. This doesn't happen when called from the MFC app.
Why does this happen in the .NET app and how do I solve it?
|
|
|
|
|
Could you provide some more detailed information about how you use this from C#? Could you also provide more details about what kind of error you see when trying to use the dll?
If my COM-memory is not totally wrong, CoCreateInstance() cannot be called until the calling thread has called CoInitalize(). Could that be your problem?
//daniel
|
|
|
|
|
Hi all,
Please provide steps to call a Delphi dll from vb.net. Any help is very much apprecited. Thanks alot.
Following I have tried and no luck.
1) Added the DLL as a refernce to the project.
-Shows an error message "Please MAke Sure that the file is accessible , and that it is a valid assembly or COM Component"
2) Used the DllImport method of System.Runtime.InteropServices
<DllImport("delphiProgram.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)> _
Public Shared Function TestFunction(ByVal strTif As String) As Long
-- Runtime it shows an error message "Unable to load DLL 'delphiProgram.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
3) used the tlbimp.exe to make the dll as an interop
-- Shows a message 'delphiProgram.dll' is not a valid type library.
Thank you.
Regards,
Rijz
|
|
|
|
|
The .DLL has to be in the same folder as your .EXE or in a folder on the PATH environment variable.
Chances are, it's not in either. You can add the .DLL to your project and, in the Properties window under "Copy to Output Directory", make sure it says "Copy Always" so the .DLL ends up in your project Debug or Release folder with your .EXE.
|
|
|
|
|
Tested with Lazarus;
library project1;
uses
Classes;
procedure DoHelloWorld(var Source: string) stdcall; export;
begin
Source := 'Hello world :)';
end;
exports DoHelloWorld;
begin
end.
Imports System.Runtime.InteropServices
Imports System.Text
Module Module1
<DllImport("project1.dll", EntryPoint:="DoHelloWorld", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)> _
Public Sub DoHelloWorld(ByRef Source As StringBuilder)
End Sub
Sub Main()
Dim sb As New StringBuilder()
DoHelloWorld(sb)
Console.WriteLine(sb.ToString())
Console.ReadKey()
End Sub
End Module
Bastard Programmer from Hell
|
|
|
|
|
I have requirement where user can pass all types of datetime formats. Also I need to validate all the datetime formats entered by user.
DateTime.TryParse() returns false, if the date passed is in dd/MM/yyyy format. I have noticed in all the forums this issue is been noted.
Can anyone reply why this error is been thrown and whats the solution so as to pass all datetime formats
|
|
|
|
|
I am unable to replicate the issue at my end.
The sample code I used to test it (form contains a textbox for input, a button with the test code below, and a label to display the result):
DateTime getDate;
bool valid = DateTime.TryParse(textBox1.Text, System.Globalization.CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.AllowWhiteSpaces, out getDate);
if (valid)
label1.Text = getDate.ToLongDateString();
else
label1.Text = "Not a valid date";
I can enter various formats, using either a number for the month or the short-hand notation or the long notation and it all works fine.
Could you tell me exactly what input doesn't work properly, for instance when you try this code?
|
|
|
|