|
I've not got any experience with Gentle.NET, have you considered NHibernate? It's still in Alpha but I believe that what it does provide is pretty stable and reasonably well tested (i.e. production quality), and I also believe it supports cascading deletes. As for a default mapping of commands to stored procedures, I don't know. You may also want to take a look at iBATIS.NET.
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Download my PGP public key
|
|
|
|
|
Seems like there're plenty of Object-Relational mapping tools around. Some of the desirable features includes:
1. transaction
2. referential integrity, cascade deletes...
3. auto-increment, uid generation
4. inheritance
5. supports used of stored procedures
6. database/provider independent access
7. generation of SQL scripts from UML
...
What important feature have I omitted here? For our project, [1], [2], [3] are basic requirements. [4], [5], [7] are "nice-to-have". [6] ... we're just working with SQL server, but the rest of our application are built pretty robustly that ... we'd prefer OR mapping tools to be data provider independent... so, let's say [6] is also a requirement.
Anyway, anyone familiar with history of OR mapping tools? Which are the most popular OR tools around?
Norman Fung
|
|
|
|
|
Hi Everyone,
i got a big problem here. I need to reproduce the behaviour of the Photoshop layer blending mode "Hard Light". If I use Photoshop load up a picture and put a layer with a solid color on top of that picture and set this layers Blending Mode to "Hard Light" then the Color of the layer seems to be mixed with the lights and darks of the underlying picture.
Then i went to my c# application:
I thought well take the overlapping pixels of the picture and the layer and mix the HSV Values together. But whatever i do i can't make it look like photoshop.
Does anyone have a clue or hint that could point me into the right direction to be able to reproduce that blending in C# ???
Any help greatly appreciated !!!
Thanks,
Oliver
|
|
|
|
|
|
Hi All,
I've a class file written using VB 6.0.
The class file has some complex methods.
Now I need to use that methods in my C# project.
It is too hard to convert the Vb code to C#.
By googling I came to know that, we can create interop wrapper to attain this goal.But I'm not aware of interop wrapper even what is that.
Pls. can anyone give me the urls or sample code on this topic ?.
Your help would be greatly appreciated.
DHARMA.R
|
|
|
|
|
You'll have to expose the VB code as an ActiveX DLL, enabling you to use .NET's COM interop support.
Here's an MSDN article that talks you through it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkCOMInteropPart1CClientTutorial.asp[^]
You'll need to scroll down a bit, to where it says Example 1: Using Tlbimp. This imports the type library, creating a managed gateway to the COM interfaces implemented by the server. All you have to do then is ensure you reference the generated assembly when compiling.
Alternatively, (if you want) you can actually declare the interfaces and GUIDs inside C# through applying attributes. Again, this is documented inside the MSDN article. However, if you've got a large interface you will probably prefer the automated approach.
For more information about .NET's interoperability, you'll definitely want to check out this section in MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconinteroperatingwithunmanagedcode.asp[^]
It covers things like threading, marshaling of types, lifecycle etc.
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Download my PGP public key
|
|
|
|
|
Hi
I have to read any schema file, and according to their datatype, it should load values for about 200 into a new xml file.
ie, a rough xml(first file -resulatant file)
<name>john1</name>
<salary>8100</salary>
<name>john2</name>
<salary>8200</salary>
<name>john3</name>
<salary>8300</salary>
<name>john4</name>
<salary>8400</salary>
like so on.. for about 200 values.
Now I have another xml file which has same "name" field all meaningful values for about 50.
(second xml file)
<name>john milton</name>
<name>stephen</name>
<name>george</name>
<name>thomas</name>
<name>paul</name> like so on for about 50 data's.
Now coming to my program, when it reads the schema, and when the schema file has the field"name" then it should read the second file and insert the data's from second file into the first xml (resultant file) for that particular field.
This is my requirement.
and this is my coding done, after running this program, i find that an error showing as "An unhandled exception system.argument exception occured"
please explain why is it occuring and how to rectify it.
Here is that part of the coding
private void button2_Click(object sender, System.EventArgs e)
{
dataSet1.ReadXmlSchema(txtSchema.Text);
foreach (DataTable dTbl in dataSet1.Tables)
{
object[] oValues = new object[dTbl.Columns.Count];
int i = 0;
XmlTextReader xtr = new XmlTextReader("C:\\CDEV\\testdatagenerator\\billtoname.xml");
while(xtr.Read())
{
foreach (DataColumn dColmn in dTbl.Columns)
{
oValues[i] = "";
if((xtr.NodeType == XmlNodeType.Element) && (xtr.Name == dColmn.ColumnName.ToString()))
{
switch(dColmn.DataType.ToString())
{
case "System.String":
oValues[i] = (string) "sachin" + i;
break;
case "System.Int32":
oValues[i] = (int) 100 + i;
break;
case "System.DateTime":
oValues[i] = new DateTime(2004,01,30).AddDays(i * 1);
break;
case "System.Decimal":
oValues[i] = new Decimal(10000900.99) + i;
break;
case "System.Int16":
oValues[i] = (short) 32767 - i;
break;
case "System.Int64":
oValues[i] = (long) 400 - i;
break;
case "System.Double":
oValues[i] = (double) 888888 - i;
break;
case "System.Single":
oValues[i] = (float) 4.5f + i;
break;
}
}
}
}
i = i+1;
dTbl.Rows.Add(oValues);
}
}
private void button3_Click(object sender, System.EventArgs e)
{
dataSet1.WriteXml(txtXml.Text,XmlWriteMode.IgnoreSchema );
MessageBox.Show("Saved");
}
}
}
|
|
|
|
|
Try stepping into the code to see which line throws the exception and repost.
If i remember correctly a System.ArgumentException is thrown when one of your
arguments passed into a function are of the incorrect type.
Kev
|
|
|
|
|
I've been asked to create an installer package for a service this morning.
Now, installing the service is nice and easy, InstallUtil "ServiceName.exe"
But i have to start the service automatically as well, anyone know how to do it?
I was hoping there would be an exe i can run or an optional parameter with
InstallUtil but i can't find anything.
Cheers
Kev
|
|
|
|
|
How to let my .net program supporting Ole Automation?
Give some examples for best.
me
|
|
|
|
|
Read Interoperating with Unmanaged Code[^] in the .NET Framework, especially sections about importing COM typelibs into .NET, and exposing your .NET assemblies to COM clients.
There are many articles here on Code Project that discuss this that you can searching using the textbox directly below the logo at the top of every page on this site, and you can click "Search comments" above this forum to search for the hundreds of threads we've discussed previous.
Start by reading those links from above to get a better understand. If you have any specific questions, please ask. This forum is not a suitable place to get an overview of a technology, but to ask questions that we can answe without writing a book (which, BTW, many books on COM interop with .NET already exist - just search Amazon.com[^]).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I often wonder what is the difference between build and rebuild. When I am developing a project I sometimes use build and sometimes use rebuild. I seem to get the same results.
What is the purpose of having both when they do the same job?
If there is a difference between the 2, which one should I use and when?
Thanks in advance,
Steve
|
|
|
|
|
And you should get the same results; but, if you read the Visual Studio .NET Product Documentation[^] - specifically about Building, Debugging, and Testing[^] - you would see that a build performs an incrementable build in a debug build, which only compiles source files that haven't changed into the assembly. In release mode, the build option - like the rebuild option in both configurations - cleans out the intermediate and object files (like the assemblies, which is a target output file) and builds all the sources since their object libraries don't exist.
This is true of just about every build system - including make and nmake - I've ever used or have read about. This allows you to compile your changes more quickly in order to get debugging and spending less time waiting for larger projects to recompile.
The result is the same, more or less. Intermediate linking doesn't produce as efficient libraries as rebuilding, which is why the default configuration for release builds has incremental linking turned off. For C# projects, this is reflected by the "Incremental Build" project under the "Advanced" section of the project options dialog.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Are multimple threads allowed to access simultaneously the same method of an instance object?
What happend then? they both run a different 'instance' of the method?
|
|
|
|
|
sb777 wrote:
Are multimple threads allowed to access simultaneously the same method of an instance object?
Yes
sb777 wrote:
What happend then? they both run a different 'instance' of the method?
No, method variables lives on the stack, and each thread maintains its own stack. Example:
public class TestClass
{
public static int Test(int i)
{
int retval = i;
return retval;
}
}
Let's assume that two different threads, tA and tB, invokes TestClass.Test:
tA pushes the 'i' integer argument on its stack, let's say the value is 42, and then it invokes
TestClass.Test.
tB pushes the 'i' integer argument on its stack, let's say the value is 9, and then it invokes TestClass.Test.
In both cases TestClass.Test makes room for the variable retval by pushing an integer to the stack of the current thread. It then sets the value of that integer to the value of i. And the value of i is found on the stack of the current thread. When you write 'return retval' you actually tells the compiler to push retval on the stack of the current thread.
So, in the example above, nothing can go wrong in a multithreaded environment. Things are getting ugly if the example looks like this though:
public class TestClass
{
private static int j;
public int J
{
get:
{
return j;
}
set:
{
j = value;
}
}
public static int Test(int i)
{
int retval = i;
return retval + j;
}
}
Things are looking good right untill retval is added to j . The problem is that j lives on the heap, so both threads will access the same reference to j . This is where you, the programmer, needs to actually think (ugh!). At some point in you code, you must find the sequence of code that isn't threadsafe, and then you must wrap it in a lock block like this:
lock(aReferenceToAnObjectSharedByBothThreads)
{
TestClass.J = x;
int y = TestClass.Test(x + 1);
}
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
First, Thanks for your answer.
Now, why did you use static method for your example? Is the same story true for instance methods?
|
|
|
|
|
You're welcome.
I used static, so I could skip the instantiation part of the code. Instance methods and instance member variables behaves just the same.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
As I understand, there is no need to lock read-only (per method or general) members.
Am I right?
|
|
|
|
|
You're right. the readonly variables has to be initialized in the constructor, and no threads can change them. Problems in multithreaded environments starts, when a thread assumes something about a variable, that can be changed in between line x and line y by another thread.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
Hi all,
Can any body help me on this ?
C# code hangs while opening word in web application. It hangs the moment it encounters the line "Documents.open" it hangs.........
Please help.
Also can anyone please give me email address of Gold. Member No. 118271 i.e. display name UB ?
Thanks in advance
Nitu
|
|
|
|
|
NituP wrote:
C# code hangs while opening word in web application. It hangs the moment it encounters the line "Documents.open" it hangs.........
And not suprisingly. Word - whether visible or not - is a Windows application that depends upon window handles which wouldn't exist for a web application since there is no window manager. There's also many other factors that exist that determine why Word would not start. If the Word.Application object is not accessible by the account under which ASP.NET is running (the local ASPNET user account, by default) or if multiple users are making requests at a time without impersonation. Word was not designed for this purpose. It is recommended that you instead use the System.Xml classes to create or modify a Word 2003 XML[^] file. There's also several articles about this here on Code Project as well, like MS Word 2003 XML Output - ASP.NET[^].
There's many reasons why Word will fail when running within the context of a web server, but without more details it's impossible to know exactly why. It can be made to work with limited support, but it will ultimately tie up your thread pool to handle multiple user requests. You really need to read and understand about COM threading models to understand why, which is beyond the scope of this forum. You can start by reading Understanding and Using COM Threading Models[^] in the MSDN Library, however.
NituP wrote:
Also can anyone please give me email address of Gold. Member No. 118271 i.e. display name UB ?
Email addresses - unless the user specifies them in their signature or description - are not published. Go to the user's profile page[^], click "Messages", and find a message they posted. Then click the "Email" link as opposed to the "Reply" link for that topic. They are emailed directly, regardless of whether or not they unchecked the option to be notified of new replies to the message you selected.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I have an mdi parent that when there is a resizable child in it (that is maximised) - if I try to open up another window(while the other child is still there) that has a fixed single border - the fixed single border form shows up maximised.
Any ideas/solutions to get around this ??
Thanks.
|
|
|
|
|
Hello!
I´m new to C# and wondering if there is a possibility to make something like Javaspaces with C#.
My goal is to write a server that has a huge load of Tasks to complete.
The server capsulate a class with some things, eg. calculations to do and put it in a "space". A client grabs this class from the space, computes it and sends back the result to the server and so on.
I hope you get what i am talking about
stumpi
ps sry for bad english
|
|
|
|
|
Sure it's possible. Practically anything is possible in the world of application design and development. How you would implement such a feature is a different matter.
While there is no particular technology already developed for you in the .NET Framework base class library (BCL), there are many classes that can help you design such an infrastructure. Since you're new to .NET development, you should start by reading Programming with the .NET Framework[^], as well as browse the table of contents for the Class Library[^] reference to see what kind of classes are available.
To find existing implementations - if any implementations for .NET exist currently - you'll need to search the web.
What your describing is simply (i.e., not simple to implement) a distributed system and are used in many applications using many different programming languages. SETI@Home[^] is one of the more famous distributed systems in public domain that is used to help search for extraterestrial life by providing large chunks of radio data to PCs to be processed and sent back the server.
If you look, I'm sure you can find many documents covering distributed systems - even for .NET. This would be a great use of .NET Remoting[^] using a two-way communications channel like the TcpChannel . This would not work so well for XML Web Services of .NET Remoting using a one-way channel like the HttpChannel , because the web (HTTP) by nature is a simple client request/server response mechanism. The servers cannot communicate with the clients unless the client establishes a connectoin with the server to request or post data.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi. I am a new member of Code Project. I have some basic beginner questions, and wonder if this is the place to ask them. I'll ask one, and if there is a better area for beginner questions, please let me know. My current question involves the key word static. Could someone please give me an explanation of it's function? I am reading a Microsoft book on C#, and I am having trouble understanding what static is all about. I looked but do not find a FAQ on this site which answers such questions. Thanks, Steve
|
|
|
|
|