Published by

Comments

# Jesse Ezell said on 12 May, 2003 02:51 PM
EntityBroker is my fav. tool for this type of thing. You don't need roundtripping, because it isn't a traditional code generator. It is pretty easy to use once you get the hang of it, but be forwarned that it is not nice if you don't play by the rules. They are improving the quality of the exceptions that are generated and making the code more robust, but the early betas, as cool as they where, did waste quite a bit of time tracking down bugs between my object schemas and the entity broker code. Still, when you consider the total number of hours saved (since you get automatic support for SQL, Oracle, OleDb, etc. and don't have to write a single line of DB code), you probably still come out ahead. Of course, my domain model is about 10x more complex than most projects, so I was really pushing the limits of what is possible. Most projects probably won't run into some of the issues I encountered.

Of course, I don't think entity broker supports stored procs, but they suck anyway :-P
# TrackBack said on 12 May, 2003 03:02 PM
Ted Graham's Blog
# Royo said on 12 May, 2003 03:50 PM
Interesting!
Can you write some of your experiences about working XP style? There arn't that many of us practicing it... :(
# Frans Bouma said on 12 May, 2003 05:10 PM
Handwriting stored procedures is a waste of time. There are some good generators available which will do this tedious job for you within seconds. I wrote LLBLGen just for this: to not have to write all those hundreds of stored procs and callcode :)

EntityBroker is a competing product so I will not say anything about that ;) Stored procs are useful when you want finegrained security on the functionality level rather than the table level. In the next version of LLBLGen I will not generate stored procedures either, just code which at runtime generates an optimiZed query especially taylored for the situation. Tests showed that for performance this isn't a big deal, SQLServer f.e. is good in caching parameteriZed execution plans, also for adhoc queries with parameters.
# Royo said on 12 May, 2003 07:19 PM
Don't be so hard on yourself. You've done more then most developrs will ever do in that direction. Kudos on that :)
# TrackBack said on 13 May, 2003 03:56 PM
Andres Aguiar's Weblog
# TrackBack said on 13 May, 2003 03:56 PM
Frans Bouma's blog
# Robert McLaws said on 13 May, 2003 06:54 PM
That, in my opinion, is an unintelligent response from Jesse, because the point of SPROCS is that they are precompiled, and they allow you to lock down your database by allowing access only to the sprocs and not to direct selects on the tables. Just think if you opened up DELETE permissions on your tables just cause you don't like SPROCs. REAL smart. Not only will your website run faster because the data will be returned faster, but you'll stop SQL Injection Attacks and you won't be leaving the key to your database under the mat.
# Paul Wilson said on 13 May, 2003 07:57 PM
The following thread has some discussion on these topics, although its long and twisted:
http://asp.net/Forums/ShowPost.aspx?PostID=35928

I think the main point about performance was that all modern databases compile and cache sql queries as well as sprocs, so as long as the same sql queries are being ran . . .

I'm not qualified to comment on the rest, as I am still a little "scared" due to my background using only sprocs also. But the O/R mapper concept is starting to make me think, especially given that MS is also getting in this space now and since its quite common in the non-MS world already. I've been trying out EntityBroker and it really is delivering on its promise so far -- which to me is less code to generate/maintain, working with real objects and typed collections, excellent query/search/sort capabilities, and automatic cross database support! I'm still learning, but I'm definitely getting very intrigued by all the non-MS concepts, including NUnit and NAnt, that are now coming to MS due to the .NET platform.
# HumanCompiler said on 13 May, 2003 11:11 PM
Just a guess here, but my guess is that since Yukon is the answer to why SP's will be used less ;)
# HumanCompiler said on 13 May, 2003 11:14 PM
ack, sorry, i really need to go to sleep...that last comment was horrible...what i meant is that I think the new features of Yukon might be why everyone's talking about using SP's less
# Thomas Tomiczek said on 14 May, 2003 02:07 AM
Frans - NICE to see yet another one leaving the SP path. Fact is that in the past SP's were GREAT - today they are not really that different. for "simple things" you can also sometimes precompile command object.

The flexibility you get by not having SP's is great - and on the security: I prefer to handle my security on the data layer OR the business layer (actually this is one of the additions for the next larger iteration of EntityBroker (2003.1), adding a COM+ like security mechanism back into the system).

SP's are a pain - from versioning (integrating with source control) to different variants over different databases - NOT the fun part you actually want to have. SOmetimes VERY usefull, 99% of the time totally useless and just adding overhead.

My advice:
(a) try not towrite or have generated a single line data laye, use a generic library
(b) if thats not possible, got for something like LLBGEN.
(c) ONLY if you are a masichist - write al lthe stuff by hand. MAYBE you have a reason for this SOMETIMES, but mostly it is the same argument that says you should write everything in assembler: a wrong understanding of today's technologies.
# Frans Bouma said on 14 May, 2003 03:27 AM
If you read the asp.net forum thread, you'll notice I defend the usage of Stored Procedures. I wrote a testlayer with stored procedures and one with dynamic generated queries. When tailored to their task (i.e.: the stored procedure didn't have optional parameters (see my tip in a recent blog) and contained the same query as the dynamic generated query) the stored procedures and the dynamic query are both as fast, perhaps the stored procedure one is a little faster, but that's very very minor. This surprised me as well, because I really thought stored procs would have the edge over dynamic parameterised queries. I'll write a little bloggy about this today. :)
# Frans Bouma said on 14 May, 2003 03:32 AM
Robert: if you use parameterised dynamic queries, you are not open for sql-injection attacks, since you just pass on parameters like you do with a stored proc call. The argument you have about security in the database is indeed the only reason why stored procedures can be a favorite, however if I can execute such a stored procedure you've locked down via tool the security is moot anyway, which means: security should be enrolled everywhere in the call-chain if you allow a small set of users access a particular piece of code.

On the DOTNET list there was a debate the other day about windows-integrated security vs sqlserver security and it turned out that windows-integrated security wasn't even possible with ASP.NET and 2 boxes, without doing multiple administration of users (or storing the userid/password in plain text somewhere), which results in sqlserver security anyway, which results in probably 1 connection string used for the complete application, which means you have to implement security yourself IN the application, which results in that stored proc security is very nice, but will not be used since there is only one user connecting to the database anyway.
# Jesse Ezell said on 14 May, 2003 03:33 PM
Take a look at it this way. If you needed to serialize your data as XML, which would you prefer: a hard coded, precompiled method that contained all your xml serialization code like this:

void Serialize(Customer c, StreamWriter output)
{
output.Write("<customer id='"+id+"'>");
output.Write("<name>"+name+"</name>");
output.Write("<email>"+email+"</email>");
output.Write("<phone>"+phone+"</phone>");
output.Write("<fax>"+fax+"</fax>");
output.Write("</customer>");
}

(This, of course, is actually a very simlified version, because you would really want to use an Xml based writer or construct an Xml DOM tree instead, so that the InnerXml values where properly encoded).

or would a nice method that did all the work for you (a la .NET's XmlSerializer)?

As most developers will agree, the MS approach here with attributes and reflection is vastly superior and saves a hell of a lot of time. I would argue that the dynamic SQL approach is superior for all the same reasons.
# Jon Galloway said on 14 May, 2003 07:08 PM
Ted -

You may want to use ExecuteScalar:

ContentID = (int)SqlHelper.ExecuteScalar(conn, "spSaveInfo",0,"blah");

I'm using an autoincrement int here instead of a GUID so I can't vouch for them. I avoid GUIDs in DB's unless replication is involved.

Here's my basic SP:

IF @ContentID = 0
BEGIN
INSERT INTO Content (Info)
VALUES (@Info);
-- Return the new id
SELECT CAST(scope_identity() as int)
END
ELSE
BEGIN
SET NOCOUNT OFF;
UPDATE Content
SET Info = @Info
WHERE ContentID = @ContentID

SELECT @ContentID
END
# Me said on 14 May, 2003 08:55 PM
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&group=microsoft.public.dotnet.distributed_apps
# Ted Graham said on 15 May, 2003 09:38 AM

As I said above, I believe the problem is calling methods that take the parameters as object[]s. The conversion of those arrays to SqlParameter[]s in the DAAB has problems with output parameters. Calling the SqlParameter[] methods seems to work fine.
# Greg Robinson said on 15 May, 2003 02:02 PM
I have had a lot of success using the DAAB with some tweaking. I pass in a structure array for my params so it works in a remote environment.
# Jimmy Nilsson said on 22 May, 2003 05:56 PM
Do you now know all of it so the design is ready? Or will the code phase make you and your team learn more and therefore force design and code changes?

I guess what you will answer.
:-)
Perhaps that can be used as an argument against detailed design?
# Robert Hurlbut said on 08 July, 2003 02:12 PM
Just an idea/suggestion, but you may be able to set up a custom rule in FxCop to look for hard-coded strings assigned with this attribute.
# Scott Cate said on 03 August, 2003 05:46 PM
I'm getting the same problem. Object must implement IConvertible.
# Sam said on 04 August, 2003 06:18 PM
Did anybody have solution for this ? Please provide the link where I can find solution for this?
# Ted Graham said on 04 August, 2003 06:26 PM

Passing SqlParameters instead of objects as the params to the Data Access block will solve this.
# Mahesh said on 06 August, 2003 09:24 AM
Your friend might either have to write a custom proxy or derive from ContextBoundObject and use interception to do the extra task/code that he needs executing for methods decorated with an attribute.

You should be able to get some sample code on MSDN for the above two methods.
Cheers
Mahesh
# Alex Hoffman said on 06 August, 2003 09:50 AM
Ted, take a look at the article on using contexts to facilitate component services in the March 2003 issue of MSDN mag. It describes how to implement custom context attributes. I believe that this is the mechanism that Microsoft will use to provide end user support for web service extensions in the future.
# Craig Andera said on 06 August, 2003 09:57 AM
Another option is to write a SoapExtension that examines the target method for the attribute and performs the appropriate pre- or post-processing. It's WebMethod-specific, but probably a little bit easier to deal with than custom proxies or more esoteric methods of code injection.

Honestly, IMO, the best way to inject code into a method is to add an explicit call to some other method. If you're adding an attribute, you're already changing source code anyway, and this approach has the advantage that what's going on is totally obvious.
# Jesse Houwing said on 06 August, 2003 10:01 AM
XC# from www.resolvecomp.com does exactly that. It is just too bad that it's currently a little low on documentation.

It works as an add-in for Visual Studio that performs some post processing after an assembly has been compiled and adds the needed code at the beginning and the end of the methods.

I haven't used it with a webmethod specifically, but I think it should work.

One thing to koop in mind is that this method is not the standard Microsoft way of accomplishing this and that it may not work with future versions of th e.Net framework.
# Randy Ridge said on 06 August, 2003 10:09 AM
I've done this to solve an odd problem that I've had. I needed a way to call a method using only a function pointer wherein you don't know the dll at compile time. Also, I use this method to set a cdecl calling convention on a delegate. Both of these things can be done using MSIL, so I came up with this hackish solution. For the MSIL injection, I have a custom attribute called IlasmAttribute, it looks like so when in use:
<br><br>
[IlasmAttribute(".maxstack 2\r\nldarg foo\r\nldarg extensionPointer\r\ncalli unmanaged stdcall void(float32)\r\nret")]<br>
public static void glFogCoordfEXT(IntPtr extensionPointer, Single foo) {}<br><br>

Hopefully that apprears vaguley correct in the comments. Then on the post-build event, I've got a batch file that runs which ildasm's my assembly, runs a post-process app which does regex replacements of the attribute call and injects the supplied MSIL in the appropriate place (also it does the appropriate replacements to inject the cdecl calling convention on similarly tagged delegates as mentioned before). Then the modified MSIL is ilasm'ed back. It works fine for me, but it's quite the kludge...
# Randy Ridge said on 06 August, 2003 10:13 AM
I guess I should reiterate that this is done on a library at compile time for a very specific purpose. The end-user never uses or even sees this attribute, so upon rereading your post, I doubt it would be of much use to your friend. My bad.
# Steven Smith said on 19 August, 2003 01:03 AM
I'm passing in an array of SqlParameter objects but still get the error:
[InvalidCastException: Object must implement IConvertible.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +45
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters)
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters)
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(String connectionString, String spName, Object[] parameterValues)
# TrackBack said on 19 August, 2003 01:23 AM
# Jim Little said on 21 November, 2003 07:49 PM
i received a similar error. i discovered that i was trying to force a base64binary into an int. once i changed the value of the sp to accept a 'timestamp' rather than an 'int' i was able to move passed the error.
# Greg Norris said on 18 December, 2003 05:45 PM
I had this problem and discovered that I had not used the [text] property of a textbox.

I was trying to pass the entire object (tbUserId) which is why this error ocurred.

The error lines:
=======================
cmd.Parameters.Add("@UserId", SqlDbType.VarChar, 128).Value = tbUserId;
cmd.Parameters.Add("@password", SqlDbType.VarChar, 32).Value = tbPassword;

my working code..
=======================
SqlCommand cmd = new SqlCommand("sp_Name");
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@UserId", SqlDbType.VarChar, 128).Value = tbUserId.Text;
cmd.Parameters.Add("@password", SqlDbType.VarChar, 32).Value = tbPassword.Text;
cmd.Parameters.Add("@UseIntegratedSecurity", SqlDbType.Bit, 1).Value = null;
cmd.Parameters.Add("@TicketTypeCode", SqlDbType.VarChar, 32).Value = null;

SessionTicketId = new SqlParameter("@SessionTicketId", SqlDbType.Int);
SessionTicketId.Direction = ParameterDirection.Output;
cmd.Parameters.Add(SessionTicketId);

returnParam = new SqlParameter("@ReturnMsg", SqlDbType.VarChar, 250);
returnParam.Direction = ParameterDirection.Output;
cmd.Parameters.Add(returnParam);

conn.Open();
cmd.ExecuteNonQuery();
# Suresh said on 19 December, 2003 06:19 PM
Thanks for this list ..hope u add more in near future...

Suresh
# Adam Weigert said on 19 December, 2003 07:12 PM
Change for #23 ... if you check the most recent guidelines for class library designers they suggest you use the System.Threading.Interlocked class. Its actually quite interesting and they say it is MUCH better for performance and locking ...
# Josh said on 19 December, 2003 09:24 PM
I personally do not like coding standards in the form of a question. It is not always clear whether you want the answer to be positive or negative. Usually they are written so that the desired response is postive which helps alleviate the issue, but I've seen them intermixed.

The best C# coding standards document I've found (and adopted at work) is at:

http://www.tiobe.com/standards/gemrcsharpcs.pdf

It's mostly based on the MSDN guidelines, but I like their format. It leans more towards a "standards", whereas your seems to include more "best practices" (which is fine).
# Darrell said on 19 December, 2003 10:18 PM
Josh, this is not a coding standard. Ted is doing this for the Personal Software Process (PSP). This would be used *in addition to* a coding standard.

The checklist is supposed to be a list of the most common mistakes that a programmer often makes. During a code review, all these items are checked, supposedly capturing the vast majority of mistakes.
# Scott said on 20 December, 2003 12:45 AM
"Is foreach used in preference to the for(int i...) construct?"

This is an interesting one.

Referencing this article http://www.c-sharpcorner.com/Code/2003/April/IterationsInNet.asp
it would seem to be that the for(int i...) is faster than a foreach. I've always found anecdotatl evidence that a foreach is slower than a for(int i...) loop. What is your experience using the two and why do you prefer foreach?
# SrinathV said on 20 December, 2003 11:57 AM
Our last project had detail security checklist broken down by App. life-cycle and technologies....

Arch & Design security review:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh05.asp

Security code Review: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh21.asp

Index of Checklists (related to security):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/CL_Index_Of.asp
# TrackBack said on 20 December, 2003 05:24 PM
# Steve said on 31 December, 2003 06:22 PM
I've taken the approach you mentioned. I test the public interface to ensure the components do what I expect. Usually if something's wrong in one of the private methods the test for the public method "catches" the error.
# Omer van Kloeten said on 01 January, 2004 09:41 AM
http://weblogs.asp.net/okloeten/archive/2003/11/01/35176.aspx#FeedBack
# Mark Hurd said on 06 January, 2004 09:29 PM
I'm sure the POV in the MS guidelines is that it is good to cater for single methods handling multiple events.

It is important for WinForms (eg Think of all the ways the user can close a window. If the event signatures are compatible all of these can be handled by the same routine, even both OK and Cancel in some cases.) and it is important for you to determine if it might be relevant for the users of your system now or in the future.
# Bill Selznick said on 12 January, 2004 03:30 PM
No there is not a bug in MDAAB, well not in this case. Ted, if you examine your example call to ExecuteNonQuery: SqlHelper.ExecuteNonQuery(ConnectionString, "InsertValidationPolicy", parameters);
You'll see that this call qualifies for the overload having the following calling sequence: ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues). Notice the last parameter which is typed as object, and is expected to be a sequence of parameter VALUES! This is the only error. Like you I also spent an hour passing PARAMETERS. Since like you I already supplied values to my parameters before making the call to ExecuteNonQuery, I changed my call so that I get the following overload: ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters). See this one expects an array of parameters and not values.
# Robi Khan said on 26 January, 2004 05:48 PM
This has always bugged me too (casting the sender).

Most of my events are custom though, so I just pass the strongly typed sender via my EventArgs subclasses. Doesn't help when using predefined event delegates though.
# Alexander Safronov said on 28 January, 2004 01:31 PM
The major advantage of testing private details, is that it will immediately pint to the place that is broken. If something is broken inside private portions of the code, then even if testing of public interface found that something is wrong, you migth spend hours trying to find where specifically you made (for example) "off-by-one" error
# Naresh said on 30 January, 2004 09:57 AM
Yes that solved my problem
# Taranath Chebrolu said on 11 March, 2004 09:31 AM
with this update of MS Data Access Application Block we can solve those problem
As per MS Data Access Application Block Code
it was
ExecuteNonQuery(SqlConnection,CommandType,commandText,commandParameters as sqlparameter)
retval = cmd.ExecuteNonQuery()

now we do modification as
Dim ints As Integer
For Each p As SqlParameter In cmd.Parameters
If p.Direction = ParameterDirection.InputOutput Then
ints = p.Value
End If
Next

then we can OUTPUT value from SP
Good Luck
Taranath
India
# Taranath Chebrolu said on 11 March, 2004 09:34 AM
with this update of MS Data Access Application Block we can solve those problem
As per MS Data Access Application Block Code
it was
ExecuteNonQuery(SqlConnection,CommandType,commandText,commandParameters as sqlparameter)
retval = cmd.ExecuteNonQuery()

now we do modification as
Dim ints As Integer
For Each p As SqlParameter In cmd.Parameters
If p.Direction = ParameterDirection.InputOutput Then
ints = p.Value
End If
Next

then we can OUTPUT value from SP
Good Luck
Taranath
India
# Taranath Chebrolu said on 11 March, 2004 09:37 AM
a bit modification
with this update code of MS Data Access Application Block we can solve our problem
As per MS Data Access Application Block Code
it was
ExecuteNonQuery(SqlConnection,CommandType,commandText,commandParameters as sqlparameter)
retval = cmd.ExecuteNonQuery()

now we do modification as
Dim ints As Integer
For Each p As SqlParameter In cmd.Parameters
If p.Direction = ParameterDirection.InputOutput Then
ints = p.Value
End If
Next
retval = ints

then we can OUTPUT value from SP
Good Luck
Taranath
India
# TrackBack said on 11 March, 2004 05:34 PM
# Adam Weigert said on 23 March, 2004 06:56 PM
I particular like the following way of doing this:

public override bool Equals(object obj) {
Customer value = (obj as Customer);

// assuming "Name" is the unique identifier for the object
if (value == null)
return false;

return this.Name.Equals(value.Name)
}

I am not sure if maybe you added the "if (obj == null) return false;" statement before the cast if that would offer better performance ... something to check out ...
# Paul Thomson said on 02 April, 2004 05:40 PM
Its seems the difference between success and failure with regards to using MSDAAB and OUTPUT parameters is using the CommandType arguement. If you do not include the CommandType.StoredProcedure, the command will complete successfully but will not return your output parameters to you. If you include this optional arguement in your method call, you should expect your output parameters back.
# Fabian said on 06 May, 2004 05:29 AM
This is not fixing wincvs freeze on start-up for me :-(
# Ted Graham said on 11 May, 2004 02:16 PM
The as idiom only works for sealed classes. In your sample code, if obj is a ValuedCustomer, Equals will return true, which is wrong.
# Jon Person said on 25 May, 2004 07:04 PM
I think the main design guideline to follow is allow developers the ability to capture similarly-typed events in one method, as stated earlier. I agree that delegate event handlers should be strongly typed (like Microsoft proscribes as a general rule), and that even vague parameters like "e" should not be allowed, but they are now so deeply established that some developers may be confused. When in Rome...

You probably have some latitude with your customers and could most likely get away with strongly-typed delegates.

Jon Person
StormSource Software
http://www.gpsdotnet.com
# Jerry Pisk said on 28 May, 2004 03:02 PM
No it isn't. There can be other process with the same name, since the name doesn't include the executable's path (or extension). You can check the Process.MainModule of processes by the same name to see if it's really your process. And does GetProcessesByName return processes that are running under a different user? If yes then do you really want to allow only one user to run your process at a time?
# Raymond Chen said on 28 May, 2004 10:05 PM
Not to mention that the other program called "myprog.exe" might not be a copy of you. It might just happen to have the same name by coincidence.

Try it: Rename your program to "explorer.exe" and run it - oops, it thinks it's already running.
# Jerry Pisk said on 29 May, 2004 03:55 PM
Raymond - isn't that what I've said? The only way to know for sure is to find the main module path and compare it to the full path of the main module of the process doing the check - and not just a string comparison, the same path can be expressed at least four ways, C:\Path\process.exe, \\.\C$\Path\process.exe, \\?\C:\Path\process.exe and \\?.\C$\Path\process.exe all point to the same file. And of course there's still the issue of security contexts (which may not be an issue if GetProcessesByName only returns processes for the current user).
# hugo batista said on 01 June, 2004 08:19 PM
Hi

See RAIL at http://rail.dei.uc.pt . There is low documentation, and it's still a little unstable, but with a little work you can use it programmatically to do what you want.

i'm having the same problem than your friend and i'll use rail + nant to solve it.
# David Hart said on 09 June, 2004 11:19 PM
I am using the ExecuteScalar. I am including the CommandType.StoredProcedure and passing in an array of sqlparameters. I set my last parameter to have a direction = ParameterDirection.Output. My command completes successfully, but my output from the command is always <undefined value>. I never get anything back. Any thoughts?
# Scott Galloway said on 16 June, 2004 05:56 PM
Excellent tip...thanks!
# Michael Collins said on 16 June, 2004 06:10 PM
I have typically used the AssemblyConfigurationAttribute attribute instead to indicate the Debug and Release builds. I think it fits a little better than using the assembly description.
# Bill McCarthy said on 16 June, 2004 09:28 PM
Hi Ted,

Actually you can tell from ILDASM if an assembly is debug or release build.

See my blog, http://msmvps.com/bill/archive/2004/06/17/8339.aspx

for a non intrusive way of telling if an assembly is debug or release
# TrackBack said on 17 June, 2004 05:38 AM
# TrackBack said on 17 June, 2004 06:32 AM
Ted Graham has a great tip on how to determine whether a .NET assembly is a Release or Debug build. Basically you just add the following code to AssemblyInfo.cs: // Compile a Debug or Release flag into the assembly. #if...
# Patrick Steele said on 17 June, 2004 09:01 AM
Becareful with AssemblyDescription attribute and COM interop.

http://weblogs.asp.net/psteele/archive/2004/06/17/158122.aspx
# tk said on 10 July, 2004 01:46 PM
If you use a parameter array to return output values, be aware that you must extract the values (using the SqlParameter Value property) after you close the SqlDataReader object.
# Please post .reg file said on 19 July, 2004 11:49 AM
Some companies don't let their employees run regedit, but do allow employees to run .reg files. Could you please post the above changes in a downloadable .reg file?

Thanks!
# Ted Graham said on 19 July, 2004 12:03 PM
If you put the following into Unflatten.reg it should work for you:

Windows Registry Editor Version 5.00 /S
[HKEY_CURRENT_USER\Software\WinCvs\wincvs\CVS settings]
"P_DisplayRecursive"=hex:00
# Mauricio Feijo said on 02 August, 2004 02:39 PM
"I am using the ExecuteScalar. I am including the CommandType.StoredProcedure and passing in an array of sqlparameters. I set my last parameter to have a direction = ParameterDirection.Output. My command completes successfully, but my output from the command is always <undefined value>. I never get anything back. Any thoughts? "

Me too. And I close the SQLDatareader.
And get Nothing on the output parameter.

Anyone have a solution?
# Bob Sargent said on 06 August, 2004 01:00 PM
Many thanks to Bill Selznick for solving this problem for me before I had to spend too many more hours trying to figure it out. (I used the wrong overload too.)
# TrackBack said on 19 August, 2004 12:56 AM
Ping Back来自:blog.csdn.net
# Doug de la Torre said on 25 August, 2004 07:02 PM
This article from Microsoft shows how to fix the problem in a code-less way, via config file. This is very handy if you have an application that is already deployed and don't want to patch the deployed DLLs with a code-based solution.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhostingremoteobjectsininternetinformationservicesiis.asp

According to that article, in

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Config\machine.config

Change

<servicePointManager checkCertificateName="true" checkCertificateRevocationList="false" />

to

<servicePointManager checkCertificateName="false"
checkCertificateRevocationList="false" />

I've tested this on a local environment here and it fixed the problem.
# TrackBack said on 26 August, 2004 02:35 PM
# Wes Haggard said on 02 December, 2004 09:05 PM
If it is really important to him he could look at XC# (http://www.resolvecorp.com/products.aspx) which allows for things like that.
# TrackBack said on 10 April, 2005 09:08 AM
^_^,Pretty Good!
# TrackBack said on 10 April, 2005 09:08 AM
^_^,Pretty Good!
# TrackBack said on 10 April, 2005 09:08 AM
^_^,Pretty Good!
# Wesner Moise said on 14 April, 2005 08:39 PM
This looks like the difference between a function's address before it is jitted and after. The first delegate may actually point to a stub routine in release mode.

I doubt it has anything to do with the optimizations that occur in Release mode.

I suspect that NGEN'd code will produce a true result as well.
# UdiDahan@TheSoftwareSimplist.com (Udi Dahan - The said on 15 April, 2005 03:21 AM
While 2 delegate objects that reference the same method on the same object may be equivalent (calling the first delegate results in the same behavior as calling the second), I would not say that they are equal.
# TrackBack said on 17 April, 2005 07:06 AM
^_~,pretty good!
# TrackBack said on 20 June, 2005 05:09 AM
"The time has come", the Walrus said, "to speak of secure communications".
There's something I've been...
# Ted Graham on .NET : Subversion Hosting said on 02 January, 2007 06:31 PM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/01/02/subversion-hosting.aspx

# Ted Graham on .NET : Razr survives the washing machine said on 11 January, 2007 10:59 PM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/01/11/razr-survives-the-washing-machine.aspx

# Ted Graham on .NET : Installing VS 2003 AFTER VS 2005 said on 14 January, 2007 12:41 PM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/01/14/installing-vs-2003-after-vs-2005.aspx

# Ted Graham on .NET : Software Startup Series said on 09 March, 2007 11:57 AM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/03/09/software-startup-series.aspx

# Ted Graham on .NET : A realistic log4net config said on 15 March, 2007 01:23 PM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/03/15/a-realistic-log4net-config.aspx

# Ted Graham on .NET : A log4net appender that uses SmtpClient said on 20 April, 2007 06:21 PM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/04/20/a-log4net-appender-that-uses-smtpclient.aspx

# Ted Graham on .NET : Loading the assembly for a custom log4net appender said on 02 May, 2007 04:46 PM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/05/02/loading-the-assembly-for-a-custom-log4net-appender.aspx

# Olof B said on 18 May, 2007 01:46 PM

So what do you do about the ".. does not override Object.GetHashCode()" warning..?

# Manish Jadhav said on 15 June, 2007 01:59 PM

The solution provided by Doug de la Torre can be implemented if you are hosting the web service and have control over the server's config. But if you are just utilizing a web service provided by somebody else, then the ICertificatePolicy hack provided by Ted is your only way around this issue.

# Peter Rilling said on 26 July, 2007 01:59 PM

If the author of Alice in Wonderland was a developer, he might have written riddles like, "when is private also public."

So far the debate on private vs. public testing has focused on the "public" being the entire outside universe and "private" being only with a class.  But let me pose an alternative view.  Suppose that the universe was reduced to that of an assembly.

I recently started working again on a pet project that I wrote years ago, and in it I have some internal classes.  These are supporting classes for the rest of the assembly.  For one reason or another I chose not to make them publicly accessible to the world.  

Although they are not public to the world, they are public in the context of the assembly.  Any class and method and property can access those internal classes, but are they testable.

I like to place the unit tests in a separate project.  I would like to be able to test those internal support classes, but I cannot without some work with reflection.

# Richard Chen said on 17 August, 2007 01:28 AM

The solution provided by Doug de la Torre means modifying the machin.config of your local machine instead of the server machine. since it is the local machine's responsibility to check whether the server certificate is authticate or not.

Therefore, it has nothering to do with the web service being hosted by yourself or somebody else.

# JG Vimalan said on 22 August, 2007 10:34 AM

Thanks Ted. Informative.

# Chris Tolleson said on 06 September, 2007 12:11 PM

Thanks for the checklist - covers some items I hadn't put on my PSP C# checklist.

# Floyd Price said on 27 September, 2007 06:31 AM

Which subversion hosting service are you using?

Did you try www.codespaces.com?

# MyName said on 25 October, 2007 10:59 AM

Il est pourri ton code, c'est normal qu'il y ait des bugs après faut pas s'étonner...

# wayneo said on 29 October, 2007 09:51 AM

MarshallByRef.

Also look at DI/AOP. These allow for code to be execute before/after/around a method/class decorated with the attribute or even configured in the appropriate file.

w://

# she sells sea shells sanibel florida said on 30 October, 2007 09:08 PM

<a href="www.justpiplanet.info/chesterfield19.html">chesterfield county public schools virginia</a> chesterfield county public schools virginia,<a href="www.wpisupplies.info/lies17.html">love-lies-bleeding plant</a> love-lies-bleeding plant,<a href="www.wpiproject.info/certain46.html">a certain spider</a> a certain spider,<a href="www.wpiproject.info/showers32.html">colored glass showers</a> colored glass showers,<a href="www.wpisupplies.info/lies17.html">believing innocent lies</a> believing innocent lies,<a href="www.pihlz.info/ran52.html">democrats ran as conservatives</a> democrats ran as conservatives,<a href="www.pihlz.info/.../a> t233,<a href="www.pihlz.info/tricia91.html">tricia smith doll</a> tricia smith doll,<a href="www.wpiproject.info/showers32.html">twater save showers</a> twater save showers,<a href="www.pihlz.info/tricia91.html">tricia rozanski of lockportil</a> tricia rozanski of lockportil,

# A log4net appender that uses SmtpClient said on 26 November, 2007 12:59 PM

Pingback from  A log4net appender that uses SmtpClient

# Could not establish trust relationship with remote server. said on 26 November, 2007 05:25 PM

Pingback from  Could not establish trust relationship with remote server.

# map said on 29 November, 2007 12:38 AM

map http://www.pumixon.0pi.com home link here

# map said on 30 November, 2007 11:18 PM

map http://www.pumixon.0pi.com home link here

# Andrew Shapira said on 10 December, 2007 06:19 AM

Another problem with the 'value==null' test in Adam's post is that if the Customer class or one of its ancestors overrides the == operator, then the test 'value == null' could throw an exception.  This depends on how the == method is written, but some implementations throw exceptions when presented with null argument(s).  Thus the test 'value == null' is bad because the Equals(Object) method is not supposed to throw an exception.  Replacing the test with '((Object)value)==null' would work, but if we are going to do that then we might as well test 'obj==null' at the top of the method.  And if we're doing that, we might as well use the GetType() system in the original post.  In summary, using the "as" idiom does not seem to be a good idea in methods that Equals(Object).

# Sam Schutte said on 12 December, 2007 09:55 AM

Thanks - I hadn't heard of that attribute before, it will be very helpful.  I guess the reason they made you use "DEBUG" is because by using a string, you could block methods from executing in other build configurations too, like if you had a build configuration named "DEBUG NO SYMBOLS", etc.

# kazuma 250 cougar overheating said on 20 December, 2007 02:16 AM

<a href="www.razahabaheights.info/sabbath29.html">wa">www.razahabaheights.info/sabbath29.html">wa pigs black sabbath</a> [url=www.razahabaheights.info/sabbath29.html]wa pigs black sabbath[/url] wa pigs black sabbath www.razahabaheights.info/sabbath29.html,<a href="www.puzzlewuzzles.info/grasshopper82.html">grasshopper">www.puzzlewuzzles.info/grasshopper82.html">grasshopper sparrow</a> [url=www.puzzlewuzzles.info/grasshopper82.html]grasshopper sparrow[/url] grasshopper sparrow www.puzzlewuzzles.info/grasshopper82.html,<a href="www.officialwuz.info/kok13.html">kiek">www.officialwuz.info/kok13.html">kiek in de kok</a> [url=www.officialwuz.info/kok13.html]kiek in de kok[/url] kiek in de kok www.officialwuz.info/kok13.html,<a href="www.wuzsupplies.info/overheating86.html">kia">www.wuzsupplies.info/overheating86.html">kia sportage overheating problem</a> [url=www.wuzsupplies.info/overheating86.html]kia sportage overheating problem[/url] kia sportage overheating problem www.wuzsupplies.info/overheating86.html,<a href="www.officialwuz.info/kok13.html">t233</a> [url=www.officialwuz.info/kok13.html]t233[/url] t233 www.officialwuz.info/kok13.html,

# cad overlay software said on 20 December, 2007 03:51 AM

<a href="www.freewuzstore.info/overlay50.html">chromium">www.freewuzstore.info/overlay50.html">chromium carbide overlay plate</a> [url=www.freewuzstore.info/overlay50.html]chromium carbide overlay plate[/url] chromium carbide overlay plate www.freewuzstore.info/overlay50.html,<a href="www.superwuz.info/peinture22.html">peinture">www.superwuz.info/peinture22.html">peinture aerosol belton</a> [url=www.superwuz.info/peinture22.html]peinture aerosol belton[/url] peinture aerosol belton www.superwuz.info/peinture22.html,<a href="www.officialwuzsupplies.info/vacant38.html">massage">www.officialwuzsupplies.info/vacant38.html">massage therapist cornwall positions vacant</a> [url=www.officialwuzsupplies.info/vacant38.html]massage therapist cornwall positions vacant[/url] massage therapist cornwall positions vacant www.officialwuzsupplies.info/vacant38.html,<a href="www.glanderiver.info/venue56.html">venue">www.glanderiver.info/venue56.html">venue for broadway shows in new york</a> [url=www.glanderiver.info/venue56.html]venue for broadway shows in new york[/url] venue for broadway shows in new york www.glanderiver.info/venue56.html,<a href="www.glanderiver.info/venue56.html">gay wedding venues</a> [url=www.glanderiver.info/venue56.html]gay wedding venues[/url] gay wedding venues www.glanderiver.info/venue56.html,

# boomers vrs seniors said on 20 December, 2007 08:58 AM

<a href="www.wuznation.info/seizures47.html">historical">www.wuznation.info/seizures47.html">historical treatments of seizures</a> [url=www.wuznation.info/seizures47.html]historical treatments of seizures[/url] historical treatments of seizures www.wuznation.info/seizures47.html,<a href="www.sawuzi.info/boomer17.html">boomers">www.sawuzi.info/boomer17.html">boomers avondale pa</a> [url=www.sawuzi.info/boomer17.html]boomers avondale pa[/url] boomers avondale pa www.sawuzi.info/boomer17.html,<a href="www.wuznation.info/seizures47.html">seizures after brain surgery</a> [url=www.wuznation.info/seizures47.html]seizures after brain surgery[/url] seizures after brain surgery www.wuznation.info/seizures47.html,<a href="www.wuznation.info/seizures47.html">diabetic dogs and seizures</a> [url=www.wuznation.info/seizures47.html]diabetic dogs and seizures[/url] diabetic dogs and seizures www.wuznation.info/seizures47.html,<a href="www.habasitio.info/preisvergleich25.html">Casio">www.habasitio.info/preisvergleich25.html">Casio FX991ES preisvergleich</a> [url=www.habasitio.info/preisvergleich25.html]Casio FX991ES preisvergleich[/url] Casio FX991ES preisvergleich www.habasitio.info/preisvergleich25.html,

# flat heat press sublimation transfer said on 20 December, 2007 03:42 PM

<a href="www.wuzsupplies.info/gwen22.html">gwen">www.wuzsupplies.info/gwen22.html">gwen welch</a> [url=www.wuzsupplies.info/gwen22.html]gwen welch[/url] gwen welch www.wuzsupplies.info/gwen22.html,<a href="www.wuzsupplies.info/gwen22.html">the sweet escape by gwen stephani</a> [url=www.wuzsupplies.info/gwen22.html]the sweet escape by gwen stephani[/url] the sweet escape by gwen stephani www.wuzsupplies.info/gwen22.html,<a href="www.glanderiver.info/race16.html">the">www.glanderiver.info/race16.html">the restaurant and fast food race: whos winning</a> [url=www.glanderiver.info/race16.html]the restaurant and fast food race: whos winning[/url] the restaurant and fast food race: whos winning www.glanderiver.info/race16.html,<a href="www.superwuz.info/polygon67.html">polygon">www.superwuz.info/polygon67.html">polygon worksheets</a> [url=www.superwuz.info/polygon67.html]polygon worksheets[/url] polygon worksheets www.superwuz.info/polygon67.html,<a href="www.wuzwizard.info/heat26.html">furnaceair">www.wuzwizard.info/heat26.html">furnaceair to air heat exchangers</a> [url=www.wuzwizard.info/heat26.html]furnaceair to air heat exchangers[/url] furnaceair to air heat exchangers www.wuzwizard.info/heat26.html,

# Dude said on 22 December, 2007 08:39 AM

Instead of the null check followed by the type check you can write:

if (!(obj is Customer))

  return false;

And instead of casting you can use the "as" operator.

# David Pickett said on 31 December, 2007 02:03 PM

On the other hand, rolling your own may be superior to "tracking" bugs via a combination of e-mail and Excel.

I would guess that the reason many small shops end up writing their own bug-tracking system is because it seems easy enough to knock out in an afternoon, and it's "free" to do so.

IMO it's much better to bite the bullet and pay for something reasonable (or set up an open source alternative, I guess) and spend your time on something that pays the bills. My company started out with TrackRecord, which was written by the people who created BRIEF, and had an...interesting...user interface that never reached critical mass among our non-developers. We switched over to TestTrack Pro, by Seapine Software, and have used that ever since. It's got a couple warts, but overall is quite nice.

(Yes, I realize I'm responding to a 4.5-year-old blog post. Thanks, Google!)

# Mani said on 08 January, 2008 07:48 AM

very useful! thank u very much.

# Roiy Zysman said on 09 January, 2008 03:28 PM

Code reviews are generally underrated. From my perspective and experience , if they are being conducted

# Matt Howells said on 10 February, 2008 09:38 AM

This sounds like Aspect Oriented Programming. Take a look at Spring.NET.

# Brett Ryan said on 14 February, 2008 12:01 AM

Hi guys, I think it's almost right though there are a couple of issues I see with the implementation.

Use of the 'is' keyword is an implicit cast of which an 'as' explicit cast may as well be used as you're going to need it later on. Performing an is then an as is redundant. This wasn't part of the solution bu just explaining why it should be avoided.

You should also be returning the "base" equals implementation if yours fails. In almost all cases it will fail, but as a practice you should rely on the base class to determine this, it could be that the base class has a bad implementation that could pass when it shouldn't, who knows, this could have been the desired design goal.

I have a standard implementation that I have in my "Class" template in VS that looks like the following:

       /// <summary>

       /// Returns true if this object is equal to <c>obj</c>.

       /// </summary>

       /// <param name="obj">Object you wish to compare to.</param>

       /// <returns>true if this object is equal to <c>obj</c>.</returns>

       public override bool Equals(object obj) {

           //if (obj != null && obj.GetType().Equals(this.GetType())) {

           //    Class1 other = obj as Class1;

           //    if ((object)other != null) {

           //        //TODO: Add Equals implementation

           //    }

           //}

           return base.Equals(obj);

       }

Simply uncommenting will provide you with a basis for property comparisons, eg

       public override bool Equals(object obj) {

           if (obj != null && obj.GetType().Equals(this.GetType())) {

               PocketIdentityKey other = obj as PocketIdentityKey;

               if ((object)other != null) {

                   return other.Cabinet == Cabinet

                       && other.Row == Row

                       && other.Tier == Tier

                       && other.SplitCode == SplitCode

                   ;

               }

           }

           return base.Equals(obj);

       }

Use of your GetHashCode implementation should always be consistant with your equals implementation as it affects the way a hashmap works, always perform an exclusive or of all properties that are being compared as a minimum, you may wish to perform a shift on some of the properties for a better uniqueness result.

# Joe Gakenheimer said on 12 March, 2008 01:11 PM

another impl:            

if (objFoo.Foo.ToString().Equals(true))

           {

               chkFoo.Checked = true;

           }

# Abdeali said on 23 April, 2008 02:27 AM

It was a time saver :)

# Unit testing private methods « Joachim Van den Bogaert’s Weblog said on 28 April, 2008 07:56 AM

Pingback from  Unit testing private methods &laquo; Joachim Van den Bogaert&#8217;s Weblog

# Bob said on 14 May, 2008 11:26 AM

how do you use this class?  You have given no instruction on how to implement it.

# filtering what to log said on 10 June, 2008 02:18 PM

is it possible to set up appenders so that one appender would log messages from one source and another from another?

# Work from home moms. said on 12 June, 2008 04:13 PM

Work from home moms.

# Jayesh said on 20 June, 2008 12:34 PM

This seems to be resolved in .NET 2.0+ as it returns TRUE in all the cases now.

# ted graham said on 01 July, 2008 08:24 AM

Pingback from  ted graham

# Ali Adnan said on 02 July, 2008 03:01 AM

Not Working!!!!!!!!!

# nemo said on 23 July, 2008 11:10 AM

This one is not too bad either: (it seems like a comprehensive security checklist)

iase.disa.mil/.../dot-net-checklist-v1r2-1.pdf

Nima

//---------------------------------------------------------

Information Security Software Tools

cryptoexperts.blogspot.com

//---------------------------------------------------------

# ламинат said on 25 August, 2008 02:25 AM

4fGood idea.8u I compleatly agree with last post.  nyo

<a href="http://skuper.ru">ламинированный паркет</a> 9h

# Robsta said on 05 September, 2008 07:23 AM

I found that the issue could also be due to not having the root certificate installed, for the relevant certificate you have.

This was found on a Windows CE device.

You can get the root certificate by taking the cert from the handheld to your windows box, then opening it.

From here, go to "Certification Path" tab, and click on the top one from the list. Then click "View Certificate", "Details", then "Copy to File...".

# Noel Wood said on 10 September, 2008 01:51 AM

Even to find out that one process is running with a name the same as the current name I think it should be processes.Length >= 1

# Diogo C S Cordeiro said on 13 September, 2008 12:26 PM

Hello, thank you for this code.

To add two little lines to it :

To use this class, you need two lines :

"using System.Net"

and right before the webservice call :

"ServicePointManager.CertificatePolicy = new AcceptServerNameMismatch();"

My problem was win untrusted root, so i had to change that if to....

# fgf said on 24 September, 2008 04:48 AM

hgjgjuhjgggh

hgj

ghjhg

# Syed Jazbi said on 25 September, 2008 04:42 PM

My email is sajazbi@hotmail.com.

I am not able to log in XML file. The following message displayed when I open the XML file:

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

--------------------------------------------------------------------------------

The operation completed successfully. Error processing resource 'file:///C:/AppLog3.xml'. Line 1, Position 363

Following is the code in my App.Config file:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

 <configSections>

   <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>

 </configSections>

 <log4net debug = "false">

   <appender name="XmlFile" type="log4net.Appender.FileAppender">

     <file value="C:\AppLog3.xml"/>

     <appendToFile value="true"/>

     <layout type="log4net.Layout.XmlLayout">

       <param name="Prefix" value="log4net" />

     </layout>

   </appender>

   <root>

     <level value="WARN"/>

     <appender-ref ref="XmlFile"/>

   </root>

 </log4net>

</configuration>

I don't know what I am doing wrong, I would really appreciate it if you can help me to resolve this issue.

Thanks.

# Kaushal Patel said on 22 October, 2008 03:26 AM

Hi Syed,

I think, you don't have admin rights to create xml file on C: drive.

I have used same config setting which you have used & its working fine.

SimpleLogin.aspx.cs:

using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;

using log4net;

using log4net.Config;

using log4net.Layout;

using log4net.Appender;

public partial class SampleLogging : System.Web.UI.Page

{

   //Creating Object of ILog

   private static readonly ILog Logger = LogManager.GetLogger(typeof(SampleLogging));

   public SampleLogging()

   {

       //BasicConfigurator.Configure();

       XmlConfigurator.Configure();

   }

   protected void Page_Load(object sender, EventArgs e)

   {

       Logger.Debug("Logging done at Debug Level.");

       Logger.Info("Logging done at Info Level.");

       Logger.Warn("Logging done at Warn Level.");

       Logger.Error("Logging done at Error Level.");

       Logger.Fatal("Logging done at Fatal Level.");

   }

}

Web.Config

<root>

     <level value="DEBUG"/>

<appender-ref ref="XmlFileAppender" />

</root>

<appender name="XmlFileAppender" type="log4net.Appender.FileAppender">

     <param name="File" value="C:\XMLLogTest1.xml"/>

     <param name="AppendToFile" value="true"/>

     <layout type="log4net.Layout.XmlLayout">

       <param name="Prefix" value="log4net" />                

     </layout>

</appender>

xml Output :

<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.4357529+05:30" level="DEBUG" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Debug Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>

<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6076312+05:30" level="INFO" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Info Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>

<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6232565+05:30" level="WARN" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Warn Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>

<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6232565+05:30" level="ERROR" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Error Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>

<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6232565+05:30" level="FATAL" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Fatal Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>

Regards,

Kaushal Patel

# Vijay said on 22 October, 2008 06:24 AM

Thanks. I would like to add Refactoring also in this checklist.

# Ananda said on 11 November, 2008 07:15 PM

You don't need to modify the machine.config.  Just add the same configuration element to your web.config / app.config file (depending on whether you are consuming the web services in a web application or another type of application).

# Maxwell B said on 17 November, 2008 04:47 PM

A more .NET 2.0 way to do this (accept any server certificate, or customize the delegate):

#if DEBUG

System.Net.ServicePointManager.ServerCertificateValidationCallback =

(System.Net.Security.RemoteCertificateValidationCallback)

delegate(

object o,

System.Security.Cryptography.X509Certificates.X509Certificate c,

System.Security.Cryptography.X509Certificates.X509Chain ch,

System.Net.Security.SslPolicyErrors s )

{

return true;

};

#endif

Then use your Web service client proxy.

# Suganya said on 18 November, 2008 05:07 PM

This code snippet doesnt work.

# fabiola-sh said on 28 November, 2008 06:18 AM

<a href= http://fasster.angelfire.com >baltimore and convention center and headquarters</a> <a href= http://gertui.angelfire.com >nasdaq 100 tennis tournament</a>

# fabiola-mr said on 28 November, 2008 06:34 AM

<a href= http://fasster.angelfire.com >baltimore and convention center and headquarters</a> <a href= http://gertui.angelfire.com >nasdaq 100 tennis tournament</a>

# fabiola-dj said on 28 November, 2008 01:27 PM

<a href= http://fairra.angelfire.com >landls end</a> <a href= http://vonucshka.angelfire.com >chancellor internal med</a>

# fabiola-bx said on 28 November, 2008 01:38 PM

<a href= http://fairra.angelfire.com >landls end</a> <a href= http://vonucshka.angelfire.com >chancellor internal med</a>

# fabiola-de said on 28 November, 2008 06:33 PM

<a href= http://chkola.angelfire.com >avlastkey</a> <a href= http://bustersw.angelfire.com >how to start a strawberry patch in alabama</a>

# fabiola-vj said on 28 November, 2008 06:43 PM

<a href= http://chkola.angelfire.com >avlastkey</a> <a href= http://bustersw.angelfire.com >how to start a strawberry patch in alabama</a>

# fabiola-pu said on 28 November, 2008 11:44 PM

<a href= http://kustur.angelfire.com >dad vail regatta</a> <a href= http://trututa.angelfire.com >ratings apartments eagle ridge alabama</a>

# fabiola-px said on 28 November, 2008 11:47 PM

<a href= http://kustur.angelfire.com >dad vail regatta</a> <a href= http://trututa.angelfire.com >ratings apartments eagle ridge alabama</a>

# Asina said on 02 December, 2008 11:40 AM

<a href= bestpre.com ></a>

# Semil said on 05 December, 2008 06:47 PM

<a href= spiritez.com ></a>

# Albina-yv said on 26 December, 2008 06:25 AM

<a href= membres.lycos.fr/maffals >genetic disorters</a>

# Olgunka-gj said on 26 December, 2008 07:43 AM

<a href= membres.lycos.fr/maffals >genetic disorters</a>

# elexx-nz said on 26 December, 2008 07:47 AM

<a href= membres.lycos.fr/dertull >zx10r graphics</a>

# elexx-oi said on 26 December, 2008 10:45 AM

<a href= membres.lycos.fr/dertull >zx10r graphics</a>

# Olgunka-ab said on 26 December, 2008 11:02 AM

<a href= membres.lycos.fr/maffals >genetic disorters</a>

# Prescription pills with overnight said on 06 January, 2009 10:58 AM

<a href="http://myrxpill.com">Prescription pills</a> http://MyRxPill.com

# Talent Certificartion said on 12 January, 2009 12:46 PM

"Is foreach used in preference to the for(int i...) construct?"

This is an interesting one.

Referencing this article www.c-sharpcorner.com/.../IterationsInNet.asp

it would seem to be that the for(int i...) is faster than a foreach. I've always found anecdotatl evidence that a foreach is slower than a for(int i...) loop. What is your experience using the two and why do you prefer foreach?

# Wertegleichheit von Objekten pr?fen | hilpers said on 17 January, 2009 12:44 PM

Pingback from  Wertegleichheit von Objekten pr?fen | hilpers

# No More Hacks said on 12 February, 2009 06:10 AM

I like the points, but I think as a checklist there are too many items here. I might know all these things as an expert developer, but as an aide-memoir a check list need to be short enough so that every item can be covered and, if need be, signed off with consuming hours for ever code review.

My own checklist is much shorter: nomorehacks.wordpress.com/.../code-review-checklist

# camilord said on 24 February, 2009 11:27 AM

thanks man.. works perfectly.. :)

# Rob said on 24 February, 2009 12:54 PM

I was taught the way you've blogged although recently have been questioning it.

We're using a Command pattern, with one public method, Execute. Within that method other commands may be called etc...

We're finding we have to Mock an awful lot in order to make sure unnecessary code isn't hit. This becomes messy and unmanageable.

I know people will argue we should refactor, but are code is quite clean, and broken down into lots of small commands. It's just that a command may call 4 others during execution.

This is leading me to looking at other ways of testing, and possibly testing private methods.

# Albina-po said on 28 February, 2009 11:17 PM

<a href= adultpersonalsfinder.com >singles</a>

# Olgunka-lc said on 01 March, 2009 12:02 AM

<a href= http://adultromancefinder.com >find partner</a>

# elexx-wk said on 01 March, 2009 12:03 AM

<a href= adultpersonalsfinder.com >find partner</a>

# ellaelax-lx said on 01 March, 2009 01:10 AM

<a href= http://adultchatsfinder.com >find partner</a>

# Larcik-pw said on 01 March, 2009 01:10 AM

<a href= adult-singles-finder.com >dating</a>

# elexx-ce said on 01 March, 2009 02:04 AM

<a href= adultpersonalsfinder.com >singles</a>

# Ashish Dekate said on 10 March, 2009 12:30 AM

Hi,

I tried putting entries in both machine.config and web.config of web application. But that didn't work.

Code is of C#. Can you plz provide in Vb.net?

# ... said on 12 March, 2009 11:53 PM

Sehr wertvolle Informationen! Empfehlen!

# ... said on 13 March, 2009 12:41 PM

Sehr wertvolle Informationen! Empfehlen!

# Boracroma said on 17 March, 2009 11:29 PM

Forum di registrazioneeeee.. Helpppp?praticamente mi sn iscritto e so ke ci sn 10 sms al giorno gratis...volevo sapere se vale la stessa cs anke x gli mms

grazie ;)

 <a href=www.chat-libera.net/.../chat-lazio.html>Chat Lazio</a>

____________

buon 2009

# mandestrip said on 20 March, 2009 06:31 AM

find stripper

# someguy said on 17 April, 2009 02:57 PM

THANKS!

Step #2 solved my problem. I developed a complex mobile app for my company that had to be put on hold for financial reasons. Finally, someone got interested again, but the device had been sitting around resulting in the battery getting low resulting in the clock resetting to an early default date. I spent hours trying every fix I knew. This did it.

# CR said on 12 May, 2009 10:40 AM

System.Net.ServicePointManager.ServerCertificateValidationCallback

is not available in Windows Mobile platform

# nick_nolipa said on 16 May, 2009 07:21 AM

www.message_rolcrolit.com

# alfred said on 02 June, 2009 11:32 PM

how to use the class? what changes need to be done on App.config

# Sanjay said on 09 June, 2009 09:43 AM

Hi Thanks a lot!

I am not OIK with point # 17 : Are readonly variables used in preference to properties without setters?

Don't you think this violets encapsulation?

# learner said on 15 June, 2009 03:41 PM

You can press esc and it should come out of flat mode...

# Andrey Sanches - MVP ASP/ASP.NET said on 28 June, 2009 08:11 PM

Que bacana !!!! Procurando por um checklist para fazer um Code Review de um projeto que estou atuando

# longfelt said on 15 October, 2009 10:33 AM

learner, thanks a bunch, that's the tip i needed.

# Ali said on 19 October, 2009 05:00 AM

yes, just adding command type solved my problem.