.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Clay: malleable C# dynamic objects - part 1: why we need it

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
When trying to build the right data structure in Orchard to contain a view model to which multiple entities blindly contribute, it became obvious pretty fast that using a dynamic structure of sorts was a must. What we needed was a hierarchical structure: a page can have a list of blog posts and a few widgets, each blog post is the composition of a number of parts such as comments, comments have authors, which can have avatars, ratings, etc. That gets us to the second requirement, which is that multiple entities that don't know about each other must contribute to building that object graph. We don't know the shape of the graph in advance and every node you build is susceptible to being expanded with new nodes. The problem is that C# static types...(read more)

View Complete Post

More Related Resource Links

Clay: malleable C# dynamic objects - part 2

In the first part of this post , I explained what requirements we have for the view models in Orchard and why we think dynamic is a good fit for such an object model. This time, we're going to look at Louis ' Clay library and how you can use it to create object graphs and consume them. But before we do that, I want to address a couple of questions. 1. If we use dynamic, aren't we losing IntelliSense and compile-time checking and all the good things that come with statically-typed languages? And is C# becoming overloaded with concepts, and trying to be good at everything but becoming good at nothing? Hush, hush, everything is going to be all right. Relax. Now think of all the XML/DOM styles of APIs that you know in .NET (or Java for that matter...(read more)

How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Cutting Edge: Managing Dynamic Content Delivery In Silverlight, Part 2


This month Dino continues his look at managing dynamic Silverlight content by discussing caching and isolated storage.

Dino Esposito

MSDN Magazine February 2009

Cutting Edge: Managing Dynamic Content Delivery In Silverlight, Part 1


This month Dino tackles the problem of large download size for Silverlight applications, explaining when to use streaming, when to divide the download, and other techniques for better performance over the wire.

Dino Esposito

MSDN Magazine January 2009

Basic Instincts: Objects and Values, Part 2: Memory Management


In the June 2002 installment of Basic Instincts I began a discus-sion of objects and values. This month I'll build on that column, so I will assume you've read the June installment and that you know the fundamental differences between value types and reference types.

Ted Pattison

MSDN Magazine October 2002

Dynamic LINQ Part 2 (Evolution)


A while ago, Scott Gu blogged about a Dynamic LINQ library that was part of the C# samples in VS2008. This library let developers put together late bound LINQ queries using a special syntax. This really comes in handy when you want to build a LINQ query based on dynamic input. Consider the following example:

public ActionResult List(string sort) {
    var northwind = new NorthwindEntities();
    IQueryable<Product> products = northwind.Products;
    switch (sort) {
        case "ProductName":
            products = products.OrderBy(p => p.ProductName);

Dynamic data source for Data Form Web Part



I am using a data form web part which is using a rest service to fetch data from the List. Now my List is having different Views, and i want depending on a certain parameter can we make the datasource to fetch data from different views.

Any help is highly appreciated.



transfer sql server objects - table list made dynamic


i've seen several links when searching for this problem but nothing definitely solves this...or if it does it seems to be among people who seem to know scripting really well and can figure stuff out. my problem is as follows.

i have a remote server that i connect to (need credentials and cannot use windows authentication), and from this box i need to extract certain tables from certain databases. i tried a linked server and its ridiculously slow. the other method was to build it via ssis (which needs a mapping structure for each table and cannot be made dynamic). lastly i came across this. this works really well, but i'm amazed that I cant use a variable for the table name. I've tried hardcoding the name, using a string and object variables but no go.

so i see that people have created a custom transfer objects with vb.net and c#. can someone please give me the layman's code block to enter into the script task? i've tried following instructions and end up with errors. As i paste the code some segments remain underlined and when you hover your mouse you see tooltips like Type StringCollection not defined. So maybe i'm missing some libraries or dll's that are supposed to go in and i have no clue which ones. i really like using the expressions and have iterated object variables and simple variables alike and its ridiculous that this is has room to be con

WPF: If Heineken did MVVM Frameworks Part 4

MVVM is to have an instance of a particular Model (say currentPerson) inside my ViewModel (say PeopleViewModel) which is exposed to the View (say PeopleView). The View binds and edits the Model directly.

This definitely flies in the face of what most people consider to be the holy grail of MVVM pattern, but it's a fairly new pattern, so people are still finding their way with it every day, and this works for me very well. The reason I do what I do, is for the following reasons:

1.I have always had the luxury of being able to write my own UI specific Model classes. I would even do this if I was using some other Model classes first, such as LINQ to SQL or LINQ to Entity Framework. As these classes don't have everything a proper WPF Model class needs in my humble opinion. Though, they are pretty good, as they are Partial classes and use INotifyPropertyChanged/DataContract etc etc
2.I am a pragmatist and I do not like writing code for the sake of writing code. I have seen some MVVM apps where the author has had a Model with 50 properties on it, that are simply repeated in the ViewModel abstraction, where the ViewModel added nothing. On that day I decided I would never do that unless I have to.
3.I honestly see no harm in writing directly to the Model from the View, JUST SO LONG AS if the Model is InValid its data NEVER makes its way to the database. I honestly see no pro

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Dynamic Data Templates in GridView ASP.NET 3.5

At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.

Building Layered Web Applications with Microsoft ASP.NET 2.0 - Part 1

"Building Layered Web Applications" that shows you how to build N-Layer applications with Microsoft ASP.NET 2.0. These articles teach you how to design, build and use custom business objects in your web application. The target audience for this series are developers that are ready to make the switch from using SqlDataSource controls to ObjectDataSource controls with custom business objects. Experience with ASP.NET 2 and C# is necessary while some knowledge about object oriented design certainly helps. The design I am going to show you in these articles is a simplified version of a design you would use in a real world application. It doesn't feature all the necessary functionality your application needs, but instead focuses on the underlying concepts.

Hello World to C# Threading Part 1

In this post we will see how we can implement simple threading. Why do we need threading? When you want you application to do more then one thing at same time, then you need to implement threading. One usual and common scenario would be when your application needs to get data from some other resource like web services and you don't want you application GUI to be freeze during this time. In that sort of case you will run the code to access web services in separate thread so your application GUI won't freeze. The System.Threading namespace .NET provide interfaces to implement multi threading.

Multithreading in .NET Applications, Part 3

Multithreading is a powerful design tool for creating high-performance applications, especially those that require user interaction. Microsoft .NET has broken down the barriers that once existed in creating multithreaded applications. The last two installments of the .NET Nuts & Bolts column were

What's new in ASP.NET 4.0 - Part II - Routing in Webforms

This post covers one such feature which is Routing in Webforms. Although Routing was available even in .NET 3.5 SP1, (check this excellent post by Phil Haack on implementing Routing in ASP.NET 3.5 with .NET 3.5 SP1), it was kind of less known. Also the plumbing work was too much for getting it implemented.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend