|
Thanks it seems that i going to follow your advice and Dave too. I'll review my notes and make an algorithm to reach my idea with your advices.
You are right i don't know anything at all about Reflection.
Thanks again
|
|
|
|
|
You can use the
DbSet = DbContext.Set(type) method to get a "non-generic" DbSet for the specified type; and which you can then use in "generic" CRUD operations like
DbSet.Add(object)
|
|
|
|
|
Very excited as you may understand - never used it before but read a lot about it. Any tips to get started?
|
|
|
|
|
Execute "Setup.exe"?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Ian Klek wrote: Any tips to get started? Don't blindly accept all its suggestions. I know that there are people who think that, out of the box, R# will make your code better. It won't - in some cases, you can end up obfuscating some extremely straightforward code which can end up making maintenance much harder.
Saying that, if you accept the R# keyboard mappings, Ctrl+T will become your best friend. Go ahead, try it.
This space for rent
|
|
|
|
|
After that, try Alt-\
And then, Shift-F12, and then Alt-`
That should be enough from the first month or so
Best,
John
-- Log Wizard - a Log Viewer that is easy and fun to use!
|
|
|
|
|
- Install
- Fiddle around
- Realize how it bogs down Visual Studio
- Uninstall
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Not to mention the endless list of underlined 'suggestions' that it gives you making it harder to spot the underlined 'syntax errors.' I have had colleagues that used it and, in my opinion, didn't really do much to improve the code besides pointing out where you could've saved lines using the ? and ?? operators and a million suggestions to use var.
if (Object.DividedByZero == true) { Universe.Implode(); }
|
|
|
|
|
Read trough the documentation of the options very carefully...Learn all the options it has and decide what to use and how...
By default R# use a sometime very dumb rule-set, and the suggestions suffer from it...So configure it for your need...
And even that, review all suggestions (and do not accept them as is) until you are feel, that you trust it...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Lucky you ! This is a great tool; it is deep, with a staggering variety of options.
imho, well worth the time to study how to use it, and to configure its options carefully.
cheers, Bill
«In art as in science there is no delight without the detail ... Let me repeat that unless these are thoroughly understood and remembered, all “general ideas” (so easily acquired, so profitably resold) must necessarily remain but worn passports allowing their bearers short cuts from one area of ignorance to another.» Vladimir Nabokov, commentary on translation of “Eugene Onegin.”
|
|
|
|
|
Ian Klek wrote: Any tips to get started? Yes. Get a really fast machine.
/ravi
|
|
|
|
|
Don't forget installing enough memory to keep Google running for the next 30 years.
This space for rent
|
|
|
|
|
I wrote 2 pairs of named pipe client/server programs: 1st pair in C# (.NET 4) 2nd pair in C++ (un-managed)
All 4 test programs use the same pipe name \\.\pipe\mypipe
The C# pair work fine with each other - I send a message from the client and it is received by the server. The C++ pair work also fine with each other.
But... when I try to run the C# client with the C++ server, or the C++ client with the C# server - then it doesn't work. The client is unable to connect to the server.
Is there something preventing the C++ client from working with the .NET server? Should it work?
Thank you.
modified 16-Feb-16 15:33pm.
|
|
|
|
|
Crazy Joe Devola wrote: The client is unable to connect to the server.
When running the C++ client and it doesn't connect, check the error code: GetLastError()
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
it returns error code 2 - ERROR_FILE_NOT_FOUND
|
|
|
|
|
You might want to try Sysinternals' Process Explorer. It can enumerate every kernel object (that includes pipes) that exists inside a process. This way you could be sure the pipe name is being created the way you intend.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
thank you.
I have Process Explorer but I don't know how to see list of objects for a process.
I used the search option to search for "mypipe". It shows that the server has a handle to \Device\NamedPipe\pipe\mypipe . I tried to check the client to open "\Device\NamedPipe\pipe\mypipe" but that didn't help (I didn't expect it to work anyway).
|
|
|
|
|
This is how the client opens the pipe:
hPipe=CreateFile("\\.\pipe\mypipe",
GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL) ;
if ( hPipe!=INVALID_HANDLE_VALUE)
{
return 0;
}
err = GetLastError();
if(err!=ERROR_PIPE_BUSY)
{
printf("Could not open pipe, GetLastError=%u\n", err);
return -1 ;
}
Create file returns an invalid handle. GetLastError() returns 2.
|
|
|
|
|
You do know that backslashes need to be escaped in C++, right? It should be:
hPipe=CreateFile("\\\\.\\pipe\\mypipe",
GENERIC_WRITE, 0,
NULL,
OPEN_EXISTING,
0,
NULL) ;
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Yes i do for some reason the codeproject shows just 1 backslash. I do have it like this:
"\\\\.\\pipe\\mypipe"
|
|
|
|
|
Let's see the code that creates the pipes in both projects.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Server: C#
NamedPipeServerStream pipeServer = new NamedPipeServerStream("\\\\.\\pipe\\mypipe", PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
pipeServer.BeginWaitForConnection(new AsyncCallback(WaitForConnectionCallBack), pipeServer);
Client: C++
hPipe=CreateFile("\\\\.\\pipe\\mypipe",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL) ;
if ( hPipe!=INVALID_HANDLE_VALUE)
{
return 0;
}
err = GetLastError();
if(err!=ERROR_PIPE_BUSY)
{
printf("Could not open pipe, GetLastError=%u\n", err);
return -1 ;
}
printf("Could not open pipe, GetLastError=%u. WaitNamedPipe.\n", err);
if(! WaitNamedPipe(pipe_name,2000))
{
printf("Could not open pipe\n");
return -1 ;
}
again:
C++ client with C++ server - works.
C# client with C# server - works.
C++ client with C# server - does not works.
Thank you.
|
|
|
|
|
This is just a guess, but could it be that since you have specified both GENERIC_READ and GENERIC_WRITE for the client, then you need to open the server as "InOut"?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I thought of that. I tried changing the server side to InOut - it did not help.
i also tried changing the client to GENERIC_WRITE without GENERIC_READ - it didn't work either.
Thank you for all the advise, tips and time you spent trying to help - much appreciated.
|
|
|
|
|
I think the problem was found....
On stackoverflow, someone posted this answer:
C#'s NamedPipeClientStream, NamedPipeServerStream automatically append ".\pipe\" to the name
I changed the C# code to open the pipe just as "mypipe" and now the connection is successful.
|
|
|
|