|
I'm thinking the possibility that from Main () can access its copy of Name_Common to do Name_Common.Cls_Common.StCommon = new Name_Common.St_Common(); For now I do not know how to do it because there is an error. So when I want to use a class, I can copy Main's global structure to that of the class. I have remembered that I did a function to make (cast) of one estrcuture to another one.
For now I can not make new Name_Common.St_Common(); of Main(). The brain has stopped me for days. I can also someone something about points 2 and 3 of debugger employment? Thank you.
|
|
|
|
|
What has this got to do with this question? Please don't hijack others posts.
This space for rent
|
|
|
|
|
|
I am on to it ...
Getting back ...
//zd
|
|
|
|
|
Everything ok with browsing the service. Filtering etc work like a charm. This is for sure client-issue.
I have tried to generate proxyclasses using 2 different tools that state they can produce proxy for OData v4.
If I try to use Add Service Reference I get en error like this :
Quote: The document at the url file:///e:/client.xml was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be <schema> and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.
- Report from 'DISCO Document' is 'Discovery document at the URL file:///e:/client.xml could not be found.'.
- The document format is not recognized.
- Report from 'WSDL Document' is 'There is an error in XML document (2, 2).'.
- <edmx xmlns="http://docs.oasis-open.org/odata/ns/edmx"> was not expected.
If the service is defined in the current solution, try building the solution and adding the service reference again.
Guess That built in proxyclass generator only handles up to V3?
This is what my Schema look like:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices>
<Schema Namespace="NAV" xmlns="http://docs.oasis-open.org/odata/ns/edm">
Thanks
|
|
|
|
|
Yes; when your previously mentioned you used a "generator" .... It's almost a given you will have less control and less transparency.
I usually go "down to the metal" first time around; and then I MAY go "fancy".
OData - the Best Way to REST
Home · object/Simple.OData.Client Wiki · GitHub
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Thanks Gerry ...
yes I dont like it either but client wanted an easy way to code against Microsoft Dynamics.
I have been all over that Odata-site and everything work as intended if you do it the raw way,
I do like the look of Simple.OData.Client. Maybe try it out. Have you tested it?
We are sending in the question to NAV developement team to see if they have any answer to why it dont work with a generator.
Thanks for all your help 
|
|
|
|
|
You're welcome.
No, I haven't tried "Simple.OData.Client"; but it has a good "smell".
But if your "raw" methods are working, I wouldn't bother.
I also wouldn't bother NAV. I would instead consider spending time giving the client an "attitude adjustment".
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
We are on the same level
I try out the Simple Client. I love the smell too.
//ZD
|
|
|
|
|
I have a class called Cls_Common.cs which contains a structure called St_Common where I declare the global variables that are common to all .cs files. I use it in Functions, compiled classes .dlls and in Mains.
I create a compiled .dll class to encrypt using these functions and the global structure of Cls_Common.cs.
When i add by reference the compiled class .dll to a Main, in the compile it generates in Visual Studio, there are actually two versions of the file Cls_Common.cs. When doing =new of the global structure, an ambiguity error occurs but execution continues and when an attempt to assign or retrieve a global structure value, occurs an error exception.
Issue:
In order to compile the Cls_Encrypt.dll class I need to include Cls_Common.cs to use common functions. At Main that includes by reference Cls_Encrypt.dll I also need to include Cls_Common.cs and that produces ambiguity.
According to Microsoft's brief solution to error CS0433, you have to compile from the command line with /reference and use an alias:
: https://msdn.microsoft.com/es-es/library/64wh5743.aspx
// compile with: /reference:cs0433_1.dll /reference:TypeBindConflicts=cs0433_2.dll
using TypeBindConflicts;
public class Test
{
public static void Main()
{
AggPubImpAggPubImp n6 = new AggPubImpAggPubImp();
}
} My Program:
==========
Cls_Common.cs:
----------------
namespace Name_Common
{
public struct St_Common
{
public string Languaje;
}
public static partial class Cls_Common
{
public static Name_Common.St_Common StCommon;
}
} Class compiled in an assembly called Cls_Encrypt.dll This class uses in Mains adding it as reference. Used to encrypt. Inside the class, calls are made to functions such as Func1.cs, Func2.cs ... That use the global variable structure Name_Common.Cls_Common.StCommon
Cls_Encrypt.cs:
---------------
public class Cls_Encrypt
{
public Cls_Encrypt()
{
if (Name_Common.Cls_Common.StCommon.Languaje == "Eng") ...
}
} Main where I added as reference to compiled class Cls_Encrypt.dll
Main.cs
-----------
namespace Name_Main
{
public Cls_Main()
{
Name_Common.Cls_Common.StCommon = new Name_Common.St_Common();
string MyVar = Name_Common.Cls_Common.StCommon.Languaje;
}
} The solution of Microsoft does not serve me because I have to leave Visual Studio to compile from the command line every time I make a change and the solution serves in the main but the functions do not refer to the alias. The solution seems like a fix.
It does not help me to pass by reference the global structure from the main to .dll because to compile the .dll I need to reference the type of the global structure of Cls_Common.cs. In addition, I would need to go through many structures because the .cs functions
are many and require new and different variables. Need global structures, not references.
I ask this:
1.- How can I use a single copy of a global structure in a compiled class .dll and in a main.
2.- When I use the Visual Studio debugger, if the form is large I can not see the code below. How to hide the form?
3.- I have read that I can stop the execution in the debugger (F9) and that I can press Interrupt, Modify a line and Continue. But he will not let me interrupt. How is made? Because now I have to stop the execution and start again.
I do not understand how this problem occurred when it is logical to use a global structure in Main, Functions and .dlls
Thank you.
modified 4-Jan-17 12:56pm.
|
|
|
|
|
Including the same file in different parts of the application will always cause this. Your main program should only use the common methods from the DLL, not include the entire file.
|
|
|
|
|
55/5000
if I use two dlls? Again I have the same problem. Think of a programmer or business who sells dlls (my case) and sells more than one to the same client.
in this case, from Main I can reference the global space of the first dll (not a good solution), but from the second dll I can not. I do not know how to refer from dlls to a common global space from Main, because I can not do without the global variables since many functions use them constantly. Seriously c# does not have a global space and Microsoft closes the topic with a brief patch That does not solve this problem? Can not be.
modified 4-Jan-17 12:24pm.
|
|
|
|
|
The only solution to this issue is to remove the duplicated code from your application. You may even need to rethink your design.
|
|
|
|
|
I'm wondering if I can compile the two dlls with the reference to Cls_Common.cs and from main do something like (if possible):
Name_Common.Cls_Common.StCommon = new global::Name_Common.St_Common();
And when I have to call the dlls do something like:
Name_Encrypt.Cls_Encrypt.StCommon = (Name_Common.St_Common)Name_Common.Cls_Common.StCommon
Help, thank you.
|
|
|
|
|
That does not sound right. It seems to me that you are trying to make things much more complicated than they need to be with this. Whatever purpose this class serves, you can only have it in one place, either in the DLL or in the EXE part, not in both.
|
|
|
|
|
I have many functions that use global variables. I need to access a common space from the dlls and Main. Is it too much to ask? Does not C# do? We are not going well.
|
|
|
|
|
Regequion wrote: Is it too much to ask? No, not at all. But you do need to get the design right, and work within the rules of what is possible and allowed. And, most of all, what is logical.
|
|
|
|
|
I don't see why you can't just create a "Common.dll" (in the "MyApp.Common" namespace, for example), that contains singletons or statics for your "shared" data and methods.
As long as this dll does not reference other dll's "higher up" (to avoid circular references), then there should be no problem "sharing".
|
|
|
|
|
how to store the value selection on calendar in database
|
|
|
|
|
There is a lot left for us to assume. Can you share these details so you can get a better response:
- Is this Windows Forms, WPF, ASP.Net WebForm, MVC, something else?
- Which database are you using (not really relevant though)?
- Have you tried anything yet?
- If 3 is a yes, post the code, tell us what is error/exception you get.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
I am trying to retreive data from a webpage with a label saying "export". The data is partially showing on the screen, if I manually click on "export" a window comes up and ask to save, save as, or cancel. I then save all data to my computer as a csv file. However when trying to get the data using c# I get the code behind "export" and not the data, code starts out as "".
I am using the following code:
WebClient webClient = new WebClient();
webClient.UseDefaultCredentials = false;
webClient.Credentials = new NetworkCredential(strUsername, strPassword);
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
webClient.DownloadFile(url, @strOutputFile);
*note url is for "export".
Can someone please point me in the right direction.
Any help will be greatly appreciated.
Thanks in advance.
Michael
modified 3-Jan-17 20:49pm.
|
|
|
|
|
Are you trying to get the page HTML or some specific data from it?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
I am trying to get the csv file full of data not the html code.
|
|
|
|
|
OK, and I assume the URL in the DownloadFile method ends with CSV. Is that correct?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|