background preloader

.NET

Facebook Twitter

ConfigurationElement Class (System.Configuration) The ConfigurationElement is an abstract class that is used to represent an XML element in a configuration file (such as Web.config). An element in a configuration file can contain zero, one, or more child elements. Notes to Inheritors You can use either a programmatic or a declarative (attributed) coding model to create a custom configuration element:

Task Scheduler Managed Wrapper. Tasks are accessed and can be enumerated through a TaskFolder. For systems supporting only the 1.0 library, there is only the root folder. The 2.0 library supports a hierarchal structure similar to a file system. The Tasks property exposes a TaskCollection instance which can enumerate tasks and provides an indexer which allows access to individual tasks by name. The TaskCollection class also has methods that allow for the creation/registration and deletion of tasks and subfolders by name.

A task is represented by a Task instance. A TaskDefinition exposes all of the properties of a task which allow you to define how and what will run when the task is triggered. Each task has a list of triggers that determine when the task will be run. The Trigger class is an abstract class that forms the foundation of the different types of triggers that can be specified for a task. The Action class is an abstract class that is the foundation for four different actions. NHibernate SetResultTransformer and DTO - Juna Software. Lately I have been exploring NHibernate and ICriteria. NHibernate is great I would recommend it to anyone but often I find the documentation and examples are hard to follow.

I found an interesting article by Max Andersen on Criteria Transformers for Hibernate but of course it applies to NHibernate as well. I tried it out and it worked well. It’s really easy with NHibernate to select a simple typed list of results For example: But how about when your HQL or ICriteria selects across multiple classes or entities. Your SQL would be like: SELECT p.ItemID, p.Name, p.Summary, d.ItemID, d.Name FROM Profile p inner join Department d on p.DepartmentID = d.ItemID First we need to create a class to hold the result of our query. From here we can create a query that returns a Generic list of ProfileDTO. NHibernate SetResultTransformer combined with the generic list make returning a typed list from a complicated query really easy. Enum coversion operations (int to enum, enum to int, string to enum, enum to string) - Daily Coding - daily coding tips and tricks, C#, .NET, ASP.NET, SQL, enum conversion, int to enum, enum to int, string to enum, enum to string.

June 4, 2008 - 9 comment(S)116,323 views (Rated 3 by 402 people) This post describes how can we convert enum into different data types. These are very often used operation. This is very simple to achieve thing. Let take an exmaple public enum EmloyeeRole { None = 0, Manager = 1, Admin = 2, Operator = 3 } enum to int To convert a enum to interger simply type cast the enum into integer EmloyeeRole role = EmloyeeRole.Manager; int roleInterger = (int)role; int to enum Same like above, simply type cast the integer to enum int roleInterger = 2; EmloyeeRole role = (EmloyeeRole)roleInterger; string to enum If you have string value and you want to type cast that into enum, then you can use Enum.Parse string roleString = "Operator"; EmloyeeRole role = (EmloyeeRole)Enum.Parse(typeof(EmloyeeRole), roleString); enum to string This is the simplest one, just use the ToString method of the enum EmloyeeRole role = EmloyeeRole.Manager; string roleString = role.ToString();

Introduction à la sérialisation XML.