|
In a C# 2008 application, I need to write code that will generate the following xml. Since
I am new to working with xml, I am wondering if you can tell me and/or
point me to a reference that will show me how to generate the following xml:
<xs:element name="AddDocuments">
<xs:complexType>
<xs:annotation>
<xs:documentation xml:lang="en">
adding Documents
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name ="PckId" type="ept:PackId"/>
<xs:element name ="FDocs" type="ept:FDocs" minOccurs="0" maxOccurs="10"/>
</xs:sequence>
<xs:complexType name="FDocs">
<xs:annotation>
<xs:documentation> Refer to the attributes doc</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="FDocMetadata" type="ept:FDocAttr">
<xs:annotation>
<xs:documentation>
This structure.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="attachmentId" type="ept:AttachmentId"/>
</xs:sequence>
</xs:complexType>
|
|
|
|
|
|
For something that small, I'd use an System.Xml.XmlDocument .
I'd use an System.Xml.XmlWriter for more complex documents.
|
|
|
|
|
In a C# 2010 desktop/console application, I am currently using linq to sql to connect to a sql server 2008 database. So far in this application, I have used straight linq to connect to the database. However now I need to obtain data from various tables so that the data can be setup for a new user to access the data. The database people at my job say it is easier to write the logic using a sql script they can give me.
Thus my question is, can linq to sql use 'stright sql' somehow? Basically can I have linq to sql use a stored procedure? If so, can you tell me and/or point me to a reference that will show me how linq to sql can use a stored procedure?
|
|
|
|
|
Take a look at this tutorial Retrieving Data Using Stored Procedures[^]. It is part 6 of an excellent LinQ to SQL tutorial.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
see below link ..
it will help ful for you
Link 1[^]
|
|
|
|
|
How can we detect from our program that a prerequired
program such as dotNetFrameWork3 or 4 is installed
and also is active now or not? thanks
|
|
|
|
|
The system will do it for you. If the framework is not installed then your program will not even start.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard MacCutchan wrote: your program will not even start.
Technically inaccurate.
It will indeed start and display a message box telling you that the required framework is missing.
|
|
|
|
|
Shameel wrote: Technically inaccurate. On the contrary, the actual program will not start. The system will receive a request to start it, and the loader will check for prerequisites and abort the loading when it discovers that a required library is not present. The point being that the user code will never get control in order to 'see' this problem.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard MacCutchan wrote: On the contrary, the actual program will not start.
The actual program WILL start and execute a native bootstrap that loads the mscoree.dll (which is Framework version agnostic). It is this dll that actually checks if the supported Runtime is installed and displays a message box if it is not installed.
Richard MacCutchan wrote: the point being that the user code will never get control in order to 'see' this problem.
Agree.
|
|
|
|
|
So the program still never gets started, the only thing that gets any control is the framework that is wrapped round the app. My point was to show that the user code has no way of checking whether a required feature is present or not. Which, after all, is what the questioner is asking about.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
FrameWork was just an example.
|
|
|
|
|
And I gave the answer based on that information. If you wish to discuss some other issue then maybe you could explain further.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
The only way to do it is to write a native code pre-loader which checks the requirements you specify and only starts your porgram if they are met. But you can't do that in C# or any other .NET language as Richard has already said - you would need to use C or C++ most likely.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
|
As I mentioned before, FrameWork was just an example. In general, how is it possible to check that a dll which is not even famous, is running or not?
|
|
|
|
|
DLLs do not 'run', they are loaded by the system when an application attempts to call a function within the DLL. Alternatively an application can load the DLL and make 'unlinked' calls to functions using the LoadLibrary() [^] and associated functions. This is true in native applications but I'm not sure that it is particularly straightforward in .NET based applications.
Perhaps a clearer explanation of what you are trying to achieve would help.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You are right, assume that a program wants to check out a printer driver is loaded or not?
|
|
|
|
|
|
Well, as Paul explains, you can enumerate all sorts of information in C++, which probably means you need to learn about P/Invoke[^]. However, you still have not explained what you are trying to achieve.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Based on your other responses your question is imprecise.
There are many things that at application either requires or desires.
The impact on the application on those depends on the nature of the item itself.
As an extreme example if you have compiled windows binary it will not run on a BASIC-STAMP. It is also ridiculous to even consider that case.
The needs can be broken into the following
1. It will always be on the target system
2. It will often be on the target system
3. It will sometimes be on the target system.
What your application does based on the above depends on the need. Choices are.
1. Do not run.
2. Run but do not enable certain functionality.
3. Run and provide default functionality.
4. Inform the user and ask them to install the functionality.
You can attempt to minimize problems by creating an appropriate installer. The nature of that installer depends on the decisions related to the above. But in general the installer must check for the specific functionality and then install it. How it does that still depends on the nature of the resource though.
And all of the above also is impacted by the license of the specific resources.
|
|
|
|
|
I wouldn't bother; I'd just write the app normally and if something is missing it will throw an Exception.
For instance, if my app tries to use the ACE engine to query an Access or Excel file, if ACE isn't present I get an Exception explaining this.
|
|
|
|
|
Guys i was working on my project. but had a brownOut(or Sag).. my computer went off. wen i try rebooting it, and try to reload the project i was working on, it returns a message saying *.csproj could not load properly... and when i follow the file path, the file is there, and when i tried to compered it with .csproj of other projects i see no differnce that could lead to this..
please help me out.
modified 14-Sep-12 10:58am.
|
|
|
|
|
It appears the .csproj file or the solution file has been corrupted somehow.
There's ahidden .suo file in the solution folder. In Explorer, open the folder containing your .sln file and turn on the options for seeing hidden files. Then delete the .suo file and reopen your solution.
If that doesn't work, you can always create a new empty project identical to the one you created before that is now corrupt and just add the code files to it.
|
|
|
|