February 2008 Entries
Lets say we want to declare a class in Javascript, which is equivalent to the following C# class. public class Student { public string FirstName = ""; public string LastName = ""; public Student( string firstname, string lastname) { this.FirstName = firstname; this.LastName = lastname; } public string GetFullName() { return FirstName + LastName; } } To write a similar class in JavaScript we can do something like the following [ but this will create memory leak, I am explaining that in a moment ]...
I was trying to host a small DNN application in one of our Server and I was facing couple of issues. Problem 1: The first problem I faced is it was always redirecting to localhost, whenever I tried http://domain.com/dnn it was redirecting to http://localhost/dnn as a result the site was un-accessible from outside. Solution This was easy to solve.1. I needed to log in as host account.2. Then I needed to go to the Admin > Site Settings page3. And finally In the Portal Alias section I added a new...
Two common errors done while writing the SqlDataProvider SQL for Dotnet Nuke Modules are1. Not saving the file that contains SqlDataProvider SQL codes in the correct format. A quick trick is to open the files in NotePad and save them as "Unicode".2. Not putting atleast 2 line breaks after each GO statement in the SQLDataProvider SQL code.Hope this helps
Check out the following from Matt Warrens blog posts, if you are interested on how to implement IQueryable Provider. source: http://blogs.msdn.com/mattw... Part I - Reusable IQueryable base classesPart II - Where and reusable Expression tree visitorPart II - Local variable referencesPart IV - SelectPart V - Improved Column bindingPart VI - Nested queriesPart VII - Join and SelectMany...
ProblemIf you try to query an ArrayList via LINQ you might be surprised to see that its not supported and throwing an exception. In other words the following query will not work at all. ArrayList students = GetStudents();var query = from student in students where student.Score > 80 select new { student.ID, student.Name }; CauseThe problem comes from the fact that LINQ to Objects has been designed to query generic collections that implement the System.Collections.Generic.... interface....
Be careful while querying the disposable object inside an using block, you may find that the yielded objects are all disposed before you have used them. To get over this issue use the ToList() method. You can exit the using block, and yield the results out. Example: IEnumerable<Student> results;using (var db = new StudentDataContext()){ results = db.Students.Where(...).ToLi... (var student in results){ SomeMethod(student); yield return student;}...