Search Results

Search found 259 results on 11 pages for 'xmlserializer'.

Page 10/11 | < Previous Page | 6 7 8 9 10 11  | Next Page >

  • C# CreateElement method - how to add an child element with xmlns=""

    - by NealWalters
    How can I get the following code to add the element with "xmlns=''"? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string strXML = "<myroot>" + " <group3 xmlns='myGroup3SerializerStyle'>" + " <firstname xmlns=''>Neal3</firstname>" + " </group3>" + "</myroot>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(strXML); XmlElement elem = xmlDoc.CreateElement(null, "lastname", null); elem.InnerText = "New-Value"; string strXPath = "/myroot/*[local-name()='group3' and namespace-uri()='myGroup3SerializerStyle']/firstname"; XmlNode insertPoint = xmlDoc.SelectSingleNode(strXPath); insertPoint.AppendChild(elem); string resultOuter = xmlDoc.OuterXml; Console.WriteLine("\n resultOuter=" + resultOuter); Console.ReadLine(); } } } My current output: resultOuter=<myroot><group3 xmlns="myGroup3SerializerStyle"><firstname xmlns="" >Neal3<lastname>New-Value</lastname></firstname></group3></myroot> The desired output: resultOuter=<myroot><group3 xmlns="myGroup3SerializerStyle"><firstname xmlns="" >Neal3<lastname xmlns="">New-Value</lastname></firstname></group3></myroot> For background, see related posts: http://www.stylusstudio.com/ssdn/default.asp?fid=23 (today) http://stackoverflow.com/questions/2410620/net-xmlserializer-to-element-formdefaultunqualified-xml (March 9, thought I fixed it, but bit me again today!)

    Read the article

  • How to handle SalesForce WSDL files for sandbox and production sites in ASP.Net?

    - by Traveling Tech Guy
    I need to authenticate users and get info about them from an ASP.Net application. Since I have 2 sites (sandbox, production) and 2 org IDs - I needed to generate 2 SalesForce WSDL files. I diffed the 2 files (each about 600kb in size) and while they are 95% the same, there are enough differences strewn all over the place - enough for me to need to use them both. I added both as web references to my solution, and here's where my problem starts.Obviously, I cannot use both references in the same file, as they contain the same classes/functions. I had to write a quick-and-dirty solution over the weekend, so I just created 2 classes - each using a different web reference - but otherwise the exact functionality, and I use the appropriate one, based on the URL the user is coming from. This works well, but strikes me as a bad (read: quick-and-dirty) solution. My question: is there any way to do one or more of the following: change the web reference on the fly? use both web references in the same file, but put one in a different namespace? find a better solution to the whole situation? I nd up with a huge XmlSerializer.dll (3mb!) - probably due to using both huge WSDL files. Thanks for your time.

    Read the article

  • WCF code generation for large/complex schema (HR-XML/OAGIS) - is there an alternative?

    - by Sasha Borodin
    Hello, and thank you for reading. I am implementing a WCF Service based on a predefined specification (HR-XML 3.0). As such, I am starting with the schema, and working my way back to code. There are a number of large Schema documents (which import yet more Schema documents) related to my implementation, provided by this specification. I am able to generate code using xsd.exe, by supplying the "main" and "supporting" xsd files as arguments. But there are several issues, and I am wondering if this is the right approach. there are litterally hundreds of classes - the code file is half a meg in size duplicate classes (ex. Type, Type1 - which both represent the same type) there are classes declared as inheriting from a base class, but that base class is not generated/defined I understand that there are limitations to the types of Schema supported by svcutil.exe/xsd.exe when targeting the DataContractSerializer and even XmlSerializer. My question is two-fold: Are code generation "issues" fairly common when dealing with larger, modular xsd files? Has anyone had success with generating data contracts from OAGIS or HR-XML schema? Given the above issues, are there better approaches to this task, avoiding generating code and working with concrete objects? Does it make better sence to read and compose a SOAP message directly, while still taking advantage of the rest of the WCF framework? I understand that I am loosing the convenience of working with .NET objects, and the framekwork-provided (de)serialization; given these losses, would it still be advantageous to base my Service on WCF? Is there some "middle ground" between working with .NET types and pure XML? Thank you very much! -Sasha Borodin DFWHC.org

    Read the article

  • Strongly Typed DataSet column requires custom type to implement IXmlSerializable?

    - by Phil
    I have a strongly typed Dataset with a single table with three columns. These columns all contain custom types. DataColumn1 is of type Parent DataColumn2 is of type Child1 DataColumn3 is of type Child2 Here is what these classes look like: [Serializable] [XmlInclude(typeof(Child1)), XmlInclude(typeof(Child2))] public abstract class Parent { public int p1; } [Serializable] public class Child1 :Parent { public int c1; } [Serializable] public class Child2 : Parent { public int c1; } now, if I add a row with DataColumn1 being null, and DataColumns 2 and 3 populated and try to serialize it, it works: DataSet1 ds = new DataSet1(); ds.DataTable1.AddDataTable1Row(null, new Child1(), new Child2()); StringBuilder sb = new StringBuilder(); using (StringWriter writer = new StringWriter(sb)) { ds.WriteXml(writer);//Works! } However, if I try to add a value to DataColumn1, it fails: DataSet1 ds = new DataSet1(); ds.DataTable1.AddDataTable1Row(new Child1(), new Child1(), new Child2()); StringBuilder sb = new StringBuilder(); using (StringWriter writer = new StringWriter(sb)) { ds.WriteXml(writer);//Fails! } Here is the Exception: "Type 'WindowsFormsApplication4.Child1, WindowsFormsApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not implement IXmlSerializable interface therefore can not proceed with serialization." I have also tried using the XmlSerializer to serialize the dataset, but I get the same exception. Does anyone know of a way to get around this where I don't have to implement IXmlSerializable on all the Child classes? Alternatively, is there a way to implement IXmlSerializable keeping all default behavior the same (ie not having any class specific code in the ReadXml and WriteXml methods)

    Read the article

  • Stop CDATA tags from being output-escaped when writing to XML in C#

    - by Smallgods
    We're creating a system outputting some data to an XML schema. Some of the fields in this schema need their formatting preserved, as it will be parsed by the end system into potentially a Word doc layout. To do this we're using <![CDATA[Some formatted text]]> tags inside of the App.Config file, then putting that into an appropriate property field in a xsd.exe generated class from our schema. Ideally the formatting wouldn't be out problem, but unfortunately thats just how the system is going. The App.Config section looks as follows: <header> <![CDATA[Some sample formatted data]]> </header> The data assignment looks as follows: HeaderSection header = ConfigurationManager.GetSection("header") as HeaderSection; report.header = "<[CDATA[" + header.Header + "]]>"; Finally, the Xml output is handled as follows: xs = new XmlSerializer(typeof(report)); fs = new FileStream (reportLocation, FileMode.Create); xs.Serialize(fs, report); fs.Flush(); fs.Close(); This should in theory produce in the final Xml a section that has information with CDATA tags around it. However, the angled brackets are being converted into &lt; and &gt; I've looked at ways of disabling Outout Escaping, but so far can only find references to XSLT sheets. I've also tried @"<[CDATA[" with the strings, but again no luck. Any help would be appreciated!

    Read the article

  • Deserialize xml which uses attribute name/value pairs

    - by Bodyloss
    My application receives a constant stream of xml files which are more or less a direct copy of the database record <record type="update"> <field name="id">987654321</field> <field name="user_id">4321</field> <field name="updated">2011-11-24 13:43:23</field> </record> And I need to deserialize this into a class which provides nullable property's for all columns class Record { public long? Id { get; set; } public long? UserId { get; set; } public DateTime? Updated { get; set; } } I just cant seem to work out a method of doing this without having to parse the xml file manually and switch on the field's name attribute to store the values. Is their a way this can be achieved quickly using an XmlSerializer? And if not is their a more efficient way of parsing it manually? Regards and thanks My main problem is that the attribute name needs to have its value set to a property name and its value as the contents of a <field>..</field> element

    Read the article

  • jquery append() method on empty XML element

    - by Anthony
    This could just be a syntax error, but I'm trying to create a Document object from scratch, starting with document.implementation.createDocument() and then using jquery's append() method to add the elements. But it's not appending: var myDoc = document.implementation.createDocument("", 'stuff', null); $("stuff",myDoc).attr("test","tested"); $("stuff",myDoc).append("<test>A</test>"); $("<test>B</test>").appendTo("stuff",soapEnv); var s = new XMLSerializer(); alert(s.serializeToString(soapEnv)); This should output: <stuff test="tested"> <test>A</test> <test>B</test> </stuff> But instead it outputs: <stuff test="tested" /> So the selector seems to be working, just not the method. My only guess is the method doesn't account for the fact that elements are empty (<stuff />) until they have children. But that's just a guess.

    Read the article

  • How to get rid of exceptions thrown by the .NET Framework

    - by Hans Løken
    In a recent project I'm using a lot of databinding and xml-serialization. I'm using C#/VS2008 and have downloaded symbol information for the .NET framework to help me when debugging. The app I'm working on has a global "catch all" exception handler to present a more presentable messages to users if there happens to be any uncaught exceptions being thrown. My problem is when I turn on Exceptions-Thrown to be able to debug exceptions before they are caught by the "catch all". It seems to me that the framework throws a lot of exceptions that are not immediately caught (for example in ReflectPropertyDescriptor) so that the exception I'm actually trying to debug gets lost in the noise. Is there any way to get rid of exceptions caused by the framework but keep the ones from my own code? Update: after more research and actually trying to get rid of the exceptions that get thrown by the framework (many which turn out to be known issues in the framework, example: http://stackoverflow.com/questions/1127431/xmlserializer-giving-filenotfoundexception-at-constructor) I finally found a solution that works for me, which is turning on "Just my code" in Tools Options Debugging General Enable Just My Code in VS2008.

    Read the article

  • What's so bad about building XML with string concatenation?

    - by wsanville
    In the thread What’s your favorite “programmer ignorance” pet peeve?, the following answer appears, with a large amount of upvotes: Programmers who build XML using string concatenation. My question is, why is building XML via string concatenation (such as a StringBuilder in C#) bad? I've done this several times in the past, as it's sometimes the quickest way for me to get from point A to point B when to comes to the data structures/objects I'm working with. So far, I have come up with a few reasons why this isn't the greatest approach, but is there something I'm overlooking? Why should this be avoided? Probably the biggest reason I can think of is you need to escape your strings manually, and most programmers will forget this. It will work great for them when they test it, but then "randomly" their apps will fail when someone throws an & symbol in their input somewhere. Ok, I'll buy this, but it's really easy to prevent the problem (SecurityElement.Escape to name one). When I do this, I usually omit the XML declaration (i.e. <?xml version="1.0"?>). Is this harmful? Performance penalties? If you stick with proper string concatenation (i.e. StringBuilder), is this anything to be concerned about? Presumably, a class like XmlWriter will also need to do a bit of string manipulation... There are more elegant ways of generating XML, such as using XmlSerializer to automatically serialize/deserialize your classes. Ok sure, I agree. C# has a ton of useful classes for this, but sometimes I don't want to make a class for something really quick, like writing out a log file or something. Is this just me being lazy? If I am doing something "real" this is my preferred approach for dealing w/ XML.

    Read the article

  • How do I deserialize a namespaced element to an object in .net?

    - by pc1oad1etter
    Given this XML snippet: ... <InSide:setHierarchyUpdates> <automaticUpdateInterval>5</automaticUpdateInterval> <shouldRunAutomaticUpdates>true<shouldRunAutomaticUpdates> </InSide:setHierarchyUpdates> ... I am attempting to serialize this object: Imports System.Xml.Serialization <XmlRoot(ElementName:="setHierarchyUpdates", namespace:="InSide")> _ Public Class HierarchyUpdate <XmlElement(ElementName:="shouldRunAutomaticUpdates")> _ Public shouldRunAutomaticUpdates As Boolean <XmlElement(ElementName:="automaticUpdateInterval")> _ Public automaticUpdateInterval As Integer End Class Like this: Dim hierarchyUpdater As New HierarchyUpdate Dim x As New XmlSerializer(hierarchyUpdater.GetType) Dim objReader As Xml.XmlNodeReader = New Xml.XmlNodeReader(myXMLNode) hierarchyUpdater = x.Deserialize(objReader) However, the object, after deserialization, has values of false and zero. If I switch the objReader to a streamreader and read this in as a file, with none of its parents and no namespaces, it works: <setHierarchyUpdates> <automaticUpdateInterval>5</automaticUpdateInterval> <shouldRunAutomaticUpdates>true<shouldRunAutomaticUpdates> </setHierarchyUpdates> What am I doing wrong? Should I use something other than XMLRoot in the class definition, because, as an XML node, it's not really the root? If so, what? Why are no errors returned when this fails?

    Read the article

  • Is this a good way to generically deserialize objects?

    - by Damien Wildfire
    I have a stream onto which serialized objects representing messages are dumped periodically. The objects are one of a very limited number of types, and other than the actual sequence of bytes that arrives, I have no way of knowing what type of message it is. I would like to simply try to deserialize it as an object of a particular type, and if an exception is thrown, try again with the next type. I have an interface that looks like this: public interface IMessageHandler<T> where T : class, IMessage { T Handle(string message); } // elsewhere: // (These are all xsd.exe-generated classes from an XML schema.) public class AppleMessage : IMessage { ... } public class BananaMessage : IMessage { ... } public class CoconutMessage : IMessage { ... } Then I wrote a GenericHandler<T> that looks like this: public class GenericHandler<T> : IMessageHandler<T> where T: class, IMessage { public class MessageHandler : IMessageHandler { T IMessageHandler.Handle(string message) { T result = default(T); try { // This utility method tries to deserialize the object with an // XmlSerializer as if it were an object of type T. result = Utils.SerializationHelper.Deserialize<T>(message); } catch (InvalidCastException e) { result = default(T); } return result; } } } Two questions: Using my GenericHandler<T> (or something similar to it), I'd now like to populate a collection with handlers that each handle a different type. Then I want to invoke each handler's Handle method on a particular message to see if it can be deserialized. If I get a null result, move onto the next handler; otherwise, the message has been deserialized. Can this be done? Is there a better way to deserialize data of unknown (but restricted) type?

    Read the article

  • xmlns="> was not expected

    - by Anthony Shaw
    OK. I'm trying to work on communicating with the Pivotal Tracker API, which only returns data in an XML format. I have the following XML that I'm trying to deserialize into my domain model. <?xml version="1.0" encoding="UTF-8"? <stories type="array" count="2" total="2" <story <id type="integer"2909137</id <project_id type="integer"68153</project_id <story_typebug</story_type <urlhttp://www.pivotaltracker.com/story/show/2909137</url <current_stateunscheduled</current_state <description</description <nameTest #2</name <requested_byAnthony Shaw</requested_by <created_at type="datetime"2010/03/23 20:05:58 EDT</created_at <updated_at type="datetime"2010/03/23 20:05:58 EDT</updated_at </story <story <id type="integer"2909135</id <project_id type="integer"68153</project_id <story_typefeature</story_type <urlhttp://www.pivotaltracker.com/story/show/2909135</url <estimate type="integer"-1</estimate <current_stateunscheduled</current_state <description</description <nameTest #1</name <requested_byAnthony Shaw</requested_by <created_at type="datetime"2010/03/23 20:05:53 EDT</created_at <updated_at type="datetime"2010/03/23 20:05:53 EDT</updated_at </story </stories My 'story' object is created as follows: public class story { public int id { get; set; } public int estimate { get; set; } public int project_id { get; set; } public string story_type { get; set; } public string url { get; set; } public string current_state { get; set; } public string description { get; set; } public string name { get; set; } public string requested_by { get; set; } public string labels { get; set; } public string lighthouse_id { get; set; } public string lighthouse_url { get; set; } public string owned_by { get; set; } public string accepted_at { get; set; } public string created_at { get; set; } public attachment[] attachments { get; set; } public note[] notes { get; set; } } When I execute my deserialization code, I receive the following exception: Exception: There is an error in XML document (2, 2). Inner Exception: <stories xmlns='' was not expected. I can deserialize the individual stories just fine, I just cannot deserialize this xml into an array of 'story' objects And my serialization code var byteArray = Encoding.ASCII.GetBytes(value); var stream = new MemoryStream(byteArray); var deserializedObject = new XmlSerializer(typeof (story[])).Deserialize(stream) Does anybody have any ideas?

    Read the article

  • Element was not expected While Deserializing an Array with XML Serialization

    - by Anthony Shaw
    OK. I'm trying to work on communicating with the Pivotal Tracker API, which only returns data in an XML format. I have the following XML that I'm trying to deserialize into my domain model. <?xml version="1.0" encoding="UTF-8"? <stories type="array" count="2" total="2" <story <id type="integer"2909137</id <project_id type="integer"68153</project_id <story_typebug</story_type <urlhttp://www.pivotaltracker.com/story/show/2909137</url <current_stateunscheduled</current_state <description</description <nameTest #2</name <requested_byAnthony Shaw</requested_by <created_at type="datetime"2010/03/23 20:05:58 EDT</created_at <updated_at type="datetime"2010/03/23 20:05:58 EDT</updated_at </story <story <id type="integer"2909135</id <project_id type="integer"68153</project_id <story_typefeature</story_type <urlhttp://www.pivotaltracker.com/story/show/2909135</url <estimate type="integer"-1</estimate <current_stateunscheduled</current_state <description</description <nameTest #1</name <requested_byAnthony Shaw</requested_by <created_at type="datetime"2010/03/23 20:05:53 EDT</created_at <updated_at type="datetime"2010/03/23 20:05:53 EDT</updated_at </story </stories My 'story' object is created as follows: public class story { public int id { get; set; } public int estimate { get; set; } public int project_id { get; set; } public string story_type { get; set; } public string url { get; set; } public string current_state { get; set; } public string description { get; set; } public string name { get; set; } public string requested_by { get; set; } public string labels { get; set; } public string lighthouse_id { get; set; } public string lighthouse_url { get; set; } public string owned_by { get; set; } public string accepted_at { get; set; } public string created_at { get; set; } public attachment[] attachments { get; set; } public note[] notes { get; set; } } When I execute my deserialization code, I receive the following exception: Exception: There is an error in XML document (2, 2). Inner Exception: <stories xmlns='' was not expected. I can deserialize the individual stories just fine, I just cannot deserialize this xml into an array of 'story' objects And my deserialization code (value is a string of the xml) var byteArray = Encoding.ASCII.GetBytes(value); var stream = new MemoryStream(byteArray); var deserializedObject = new XmlSerializer(typeof (story[])).Deserialize(stream) Does anybody have any ideas?

    Read the article

  • How do I serialize an object to xml but not have it be the root element of the xml document

    - by mezoid
    I have the following object: public class MyClass { public int Id { get; set;} public string Name { get; set; } } I'm wanting to serialize this to the following xml string: <MyClass> <Id>1</Id> <Name>My Name</Name> </MyClass> Unfortunately, when I use the XMLSerializer I get a string which looks like: <?xml version="1.0" encoding="utf-8"?> <MyClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>1</Id> <Name>My Name</Name> </MyClass> I'm not wanting MyClass to be the root element the document, rather I'm eventually wanting to add the string with other similar serialized objects which will be within a larger xml document. i.e. Eventually I'll have a xml string which looks like this: <Classes> <MyClass> <Id>1</Id> <Name>My Name</Name> </MyClass> <MyClass> <Id>1</Id> <Name>My Name</Name> </MyClass> </Classes>" My first thought was to create a class as follows: public class Classes { public List<MyClass> MyClasses { get; set; } } ...but that just addes an additional node called MyClasses to wrap the list of MyClass.... My gut feeling is that I'm approaching this the wrong way and that my lack of experience with creating xml files isn't helping to point me to some part of the .NET framework or some other library that simplifies this.

    Read the article

  • Nservicebus serization issue of derived types

    - by Tiju John
    Hi Guys, for the context setting, I am exchanging messages between my nServiceBus client and nSerivceBus server. its is the namespace xyz.Messages and and a class, Message : IMessage I have more messages that are in the other dlls, like xyz.Messages.Domain1, xyz.Messages.Domain2, xyz.Messages.Domain3. and messages that derive form that base message, Message. I have the endpoints defined as like : at client <UnicastBusConfig> <MessageEndpointMappings> <add Messages="xyz.Messages" Endpoint="xyzServerQueue" /> <add Messages="xyz.Messages.Domain1" Endpoint="xyzServerQueue" /> <add Messages="xyz.Messages.Domain2" Endpoint="xyzServerQueue" /> </MessageEndpointMappings> </UnicastBusConfig> at Server <UnicastBusConfig> <MessageEndpointMappings> <add Messages="xyz.Messages" Endpoint="xyzClientQueue" /> <add Messages="xyz.Messages.Domain1" Endpoint="xyzClientQueue" /> <add Messages="xyz.Messages.Domain2" Endpoint="xyzClientQueue" /> </MessageEndpointMappings> </UnicastBusConfig> and the bus initialized as IBus serviceBus = Configure.With() .SpringBuilder() .XmlSerializer() .MsmqTransport() .UnicastBus() .LoadMessageHandlers() .CreateBus() .Start(); now when i try sending instance of Message type or any type derived types of Message, it successfully sends the message over and at the server, i get the proper type. eg. Message message= new Message(); Bus.Send(message); // works fine, transfers Message type message = new MessageDerived1(); Bus.Send(message); // works fine, transfers MessageDerived1 type message = new MessageDerived2(); Bus.Send(message); // works fine, transfers MessageDerived2 type My problem arises when any type, say MessageDerived1, contains a member variable of type Message, and when i assign it to a derived type, the type is not properly transferred over the wire. It transfers only as Message type, not the derived type. public class MessageDerived2 : Message { public Message message; } MessageDerived2 messageDerived2= new MessageDerived2(); messageDerived2.message = new MessageDerived1(); message = messageDerived2; Bus.Send(message); // incorrect behaviour, transfers MessageDerived2 correctly, but looses type of MessageDerived2.Message (it deserializes as Message type, instead of MessageDerived1) any help is strongly appreciated. Thanks TJ

    Read the article

  • representing an XML config file with an IXmlSerializable class

    - by Sarah Vessels
    I'm writing in C# and trying to represent an XML config file through an IXmlSerializable class. I'm unsure how to represent the nested elements in my config file, though, such as logLevel: <?xml version="1.0" encoding="utf-8" ?> <configuration> <logging> <logLevel>Error</logLevel> </logging> <credentials> <user>user123</user> <host>localhost</host> <password>pass123</password> </credentials> <credentials> <user>user456</user> <host>my.other.domain.com</host> <password>pass456</password> </credentials> </configuration> There is an enum called LogLevel that represents all the possible values for the logLevel tag. The tags within credentials should all come out as strings. In my class, called DLLConfigFile, I had the following: [XmlElement(ElementName="logLevel", DataType="LogLevel")] public LogLevel LogLevel; However, this isn't going to work because <logLevel> isn't within the root node of the XML file, it's one node deeper in <logging>. How do I go about doing this? As for the <credentials> nodes, my guess is I will need a second class, say CredentialsSection, and have a property such as the following: [XmlElement(ElementName="credentials", DataType="CredentialsSection")] public CredentialsSection[] AllCredentials; Edit: okay, I tried Robert Love's suggestion and created a LoggingSection class. However, my test fails: var xs = new XmlSerializer(typeof(DLLConfigFile)); using (var stream = new FileStream(_configPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var streamReader = new StreamReader(stream)) { XmlReader reader = new XmlTextReader(streamReader); var file = (DLLConfigFile)xs.Deserialize(reader); Assert.IsNotNull(file); LoggingSection logging = file.Logging; Assert.IsNotNull(logging); // fails here LogLevel logLevel = logging.LogLevel; Assert.IsNotNull(logLevel); Assert.AreEqual(EXPECTED_LOG_LEVEL, logLevel); } } The config file I'm testing with definitely has <logging>. Here's what the classes look like: [Serializable] [XmlRoot("logging")] public class LoggingSection : IXmlSerializable { public XmlSchema GetSchema() { return null; } [XmlElement(ElementName="logLevel", DataType="LogLevel")] public LogLevel LogLevel; public void ReadXml(XmlReader reader) { LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), reader.ReadString()); } public void WriteXml(XmlWriter writer) { writer.WriteString(Enum.GetName(typeof(LogLevel), LogLevel)); } } [Serializable] [XmlRoot("configuration")] public class DLLConfigFile : IXmlSerializable { [XmlElement(ElementName="logging", DataType="LoggingSection")] public LoggingSection Logging; }

    Read the article

  • C# Extension Methods - To Extend or Not To Extend...

    - by James Michael Hare
    I've been thinking a lot about extension methods lately, and I must admit I both love them and hate them. They are a lot like sugar, they taste so nice and sweet, but they'll rot your teeth if you eat them too much.   I can't deny that they aren't useful and very handy. One of the major components of the Shared Component library where I work is a set of useful extension methods. But, I also can't deny that they tend to be overused and abused to willy-nilly extend every living type.   So what constitutes a good extension method? Obviously, you can write an extension method for nearly anything whether it is a good idea or not. Many times, in fact, an idea seems like a good extension method but in retrospect really doesn't fit.   So what's the litmus test? To me, an extension method should be like in the movies when a person runs into their twin, separated at birth. You just know you're related. Obviously, that's hard to quantify, so let's try to put a few rules-of-thumb around them.   A good extension method should:     Apply to any possible instance of the type it extends.     Simplify logic and improve readability/maintainability.     Apply to the most specific type or interface applicable.     Be isolated in a namespace so that it does not pollute IntelliSense.     So let's look at a few examples in relation to these rules.   The first rule, to me, is the most important of all. Once again, it bears repeating, a good extension method should apply to all possible instances of the type it extends. It should feel like the long lost relative that should have been included in the original class but somehow was missing from the family tree.    Take this nifty little int extension, I saw this once in a blog and at first I really thought it was pretty cool, but then I started noticing a code smell I couldn't quite put my finger on. So let's look:       public static class IntExtensinos     {         public static int Seconds(int num)         {             return num * 1000;         }           public static int Minutes(int num)         {             return num * 60000;         }     }     This is so you could do things like:       ...     Thread.Sleep(5.Seconds());     ...     proxy.Timeout = 1.Minutes();     ...     Awww, you say, that's cute! Well, that's the problem, it's kitschy and it doesn't always apply (and incidentally you could achieve the same thing with TimeStamp.FromSeconds(5)). It's syntactical candy that looks cool, but tends to rot and pollute the code. It would allow things like:       total += numberOfTodaysOrders.Seconds();     which makes no sense and should never be allowed. The problem is you're applying an extension method to a logical domain, not a type domain. That is, the extension method Seconds() doesn't really apply to ALL ints, it applies to ints that are representative of time that you want to convert to milliseconds.    Do you see what I mean? The two problems, in a nutshell, are that a) Seconds() called off a non-time value makes no sense and b) calling Seconds() off something to pass to something that does not take milliseconds will be off by a factor of 1000 or worse.   Thus, in my mind, you should only ever have an extension method that applies to the whole domain of that type.   For example, this is one of my personal favorites:       public static bool IsBetween<T>(this T value, T low, T high)         where T : IComparable<T>     {         return value.CompareTo(low) >= 0 && value.CompareTo(high) <= 0;     }   This allows you to check if any IComparable<T> is within an upper and lower bound. Think of how many times you type something like:       if (response.Employee.Address.YearsAt >= 2         && response.Employee.Address.YearsAt <= 10)     {     ...     }     Now, you can instead type:       if(response.Employee.Address.YearsAt.IsBetween(2, 10))     {     ...     }     Note that this applies to all IComparable<T> -- that's ints, chars, strings, DateTime, etc -- and does not depend on any logical domain. In addition, it satisfies the second point and actually makes the code more readable and maintainable.   Let's look at the third point. In it we said that an extension method should fit the most specific interface or type possible. Now, I'm not saying if you have something that applies to enumerables, you create an extension for List, Array, Dictionary, etc (though you may have reasons for doing so), but that you should beware of making things TOO general.   For example, let's say we had an extension method like this:       public static T ConvertTo<T>(this object value)     {         return (T)Convert.ChangeType(value, typeof(T));     }         This lets you do more fluent conversions like:       double d = "5.0".ConvertTo<double>();     However, if you dig into Reflector (LOVE that tool) you will see that if the type you are calling on does not implement IConvertible, what you convert to MUST be the exact type or it will throw an InvalidCastException. Now this may or may not be what you want in this situation, and I leave that up to you. Things like this would fail:       object value = new Employee();     ...     // class cast exception because typeof(IEmployee) != typeof(Employee)     IEmployee emp = value.ConvertTo<IEmployee>();       Yes, that's a downfall of working with Convertible in general, but if you wanted your fluent interface to be more type-safe so that ConvertTo were only callable on IConvertibles (and let casting be a manual task), you could easily make it:         public static T ConvertTo<T>(this IConvertible value)     {         return (T)Convert.ChangeType(value, typeof(T));     }         This is what I mean by choosing the best type to extend. Consider that if we used the previous (object) version, every time we typed a dot ('.') on an instance we'd pull up ConvertTo() whether it was applicable or not. By filtering our extension method down to only valid types (those that implement IConvertible) we greatly reduce our IntelliSense pollution and apply a good level of compile-time correctness.   Now my fourth rule is just my general rule-of-thumb. Obviously, you can make extension methods as in-your-face as you want. I included all mine in my work libraries in its own sub-namespace, something akin to:       namespace Shared.Core.Extensions { ... }     This is in a library called Shared.Core, so just referencing the Core library doesn't pollute your IntelliSense, you have to actually do a using on Shared.Core.Extensions to bring the methods in. This is very similar to the way Microsoft puts its extension methods in System.Linq. This way, if you want 'em, you use the appropriate namespace. If you don't want 'em, they won't pollute your namespace.   To really make this work, however, that namespace should only include extension methods and subordinate types those extensions themselves may use. If you plant other useful classes in those namespaces, once a user includes it, they get all the extensions too.   Also, just as a personal preference, extension methods that aren't simply syntactical shortcuts, I like to put in a static utility class and then have extension methods for syntactical candy. For instance, I think it imaginable that any object could be converted to XML:       namespace Shared.Core     {         // A collection of XML Utility classes         public static class XmlUtility         {             ...             // Serialize an object into an xml string             public static string ToXml(object input)             {                 var xs = new XmlSerializer(input.GetType());                   // use new UTF8Encoding here, not Encoding.UTF8. The later includes                 // the BOM which screws up subsequent reads, the former does not.                 using (var memoryStream = new MemoryStream())                 using (var xmlTextWriter = new XmlTextWriter(memoryStream, new UTF8Encoding()))                 {                     xs.Serialize(xmlTextWriter, input);                     return Encoding.UTF8.GetString(memoryStream.ToArray());                 }             }             ...         }     }   I also wanted to be able to call this from an object like:       value.ToXml();     But here's the problem, if i made this an extension method from the start with that one little keyword "this", it would pop into IntelliSense for all objects which could be very polluting. Instead, I put the logic into a utility class so that users have the choice of whether or not they want to use it as just a class and not pollute IntelliSense, then in my extensions namespace, I add the syntactical candy:       namespace Shared.Core.Extensions     {         public static class XmlExtensions         {             public static string ToXml(this object value)             {                 return XmlUtility.ToXml(value);             }         }     }   So now it's the best of both worlds. On one hand, they can use the utility class if they don't want to pollute IntelliSense, and on the other hand they can include the Extensions namespace and use as an extension if they want. The neat thing is it also adheres to the Single Responsibility Principle. The XmlUtility is responsible for converting objects to XML, and the XmlExtensions is responsible for extending object's interface for ToXml().

    Read the article

  • Profiling Startup Of VS2012 &ndash; SpeedTrace Profiler

    - by Alois Kraus
    SpeedTrace is a relatively unknown profiler made a company called Ipcas. A single professional license does cost 449€+VAT. For the test I did use SpeedTrace 4.5 which is currently Beta. Although it is cheaper than dotTrace it has by far the most options to influence how profiling does work. First you need to create a tracing project which does configure tracing for one process type. You can start the application directly from the profiler or (much more interesting) it does attach to a specific process when it is started. For this you need to check “Trace the specified …” radio button and enter the process name in the “Process Name of the Trace” edit box. You can even selectively enable tracing for processes with a specific command line. Then you need to activate the trace project by pressing the Activate Project button and you are ready to start VS as usual. If you want to profile the next 10 VS instances that you start you can set the Number of Processes counter to e.g. 10. This is immensely helpful if you are trying to profile only the next 5 started processes. As you can see there are many more tabs which do allow to influence tracing in a much more sophisticated way. SpeedTrace is the only profiler which does not rely entirely on the profiling Api of .NET. Instead it does modify the IL code (instrumentation on the fly) to write tracing information to disc which can later be analyzed. This approach is not only very fast but it does give you unprecedented analysis capabilities. Once the traces are collected they do show up in your workspace where you can open the trace viewer. I do skip the other windows because this view is by far the most useful one. You can sort the methods not only by Wall Clock time but also by CPU consumption and wait time which none of the other products support in their views at the same time. If you want to optimize for CPU consumption sort by CPU time. If you want to find out where most time is spent you need Clock Total time and Clock Waiting. There you can directly see if the method did take long because it did wait on something or it did really execute stuff that did take so long. Once you have found a method you want to drill deeper you can double click on a method to get to the Caller/Callee view which is similar to the JetBrains Method Grid view. But this time you do see much more. In the middle is the clicked method. Above are the methods that call you and below are the methods that you do directly call. Normally you would then start digging deeper to find the end of the chain where the slow method worth optimizing is located. But there is a shortcut. You can press the magic   button to calculate the aggregation of all called methods. This is displayed in the lower left window where you can see each method call and how long it did take. There you can also sort to see if this call stack does only contain methods (e.g. WCF connect calls which you cannot make faster) not worth optimizing. YourKit has a similar feature where it is called Callees List. In the Functions tab you have in the context menu also many other useful analysis options One really outstanding feature is the View Call History Drilldown. When you select this one you get not a sum of all method invocations but a list with the duration of each method call. This is not surprising since SpeedTrace does use tracing to get its timings. There you can get many useful graphs how this method did behave over time. Did it become slower at some point in time or was only the first call slow? The diagrams and the list will tell you that. That is all fine but what should I do when one method call was slow? I want to see from where it was coming from. No problem select the method in the list hit F10 and you get the call stack. This is a life saver if you e.g. search for serialization problems. Today Serializers are used everywhere. You want to find out from where the 5s XmlSerializer.Deserialize call did come from? Hit F10 and you get the call stack which did invoke the 5s Deserialize call. The CPU timeline tab is also useful to find out where long pauses or excessive CPU consumption did happen. Click in the graph to get the Thread Stacks window where you can get a quick overview what all threads were doing at this time. This does look like the Stack Traces feature in YourKit. Only this time you get the last called method first which helps to quickly see what all threads were executing at this moment. YourKit does generate a rather long list which can be hard to go through when you have many threads. The thread list in the middle does not give you call stacks or anything like that but you see which methods were found most often executing code by the profiler which is a good indication for methods consuming most CPU time. This does sound too good to be true? I have not told you the best part yet. The best thing about this profiler is the staff behind it. When I do see a crash or some other odd behavior I send a mail to Ipcas and I do get usually the next day a mail that the problem has been fixed and a download link to the new version. The guys at Ipcas are even so helpful to log in to your machine via a Citrix Client to help you to get started profiling your actual application you want to profile. After a 2h telco I was converted from a hater to a believer of this tool. The fast response time might also have something to do with the fact that they are actively working on 4.5 to get out of the door. But still the support is by far the best I have encountered so far. The only downside is that you should instrument your assemblies including the .NET Framework to get most accurate numbers. You can profile without doing it but then you will see very high JIT times in your process which can severely affect the correctness of the measured timings. If you do not care about exact numbers you can also enable in the main UI in the Data Trace tab logging of method arguments of primitive types. If you need to know what files at which times were opened by your application you can find it out without a debugger. Since SpeedTrace does read huge trace files in its reader you should perhaps use a 64 bit machine to be able to analyze bigger traces as well. The memory consumption of the trace reader is too high for my taste. But they did promise for the next version to come up with something much improved.

    Read the article

  • Deserialize an XML file - an error in xml document (1,2)

    - by Lindsay Fisher
    I'm trying to deserialize an XML file which I receive from a vendor with XmlSerializer, however im getting this exception: There is an error in XML document (1, 2).InnerException Message "<delayedquotes xmlns=''> was not expected.. I've searched the stackoverflow forum, google and implemented the advice, however I'm still getting the same error. Please find the enclosed some content of the xml file: <delayedquotes id="TestData"> <headings> <title/> <bid>bid</bid> <offer>offer</offer> <trade>trade</trade> <close>close</close> <b_time>b_time</b_time> <o_time>o_time</o_time> <time>time</time> <hi.lo>hi.lo</hi.lo> <perc>perc</perc> <spot>spot</spot> </headings> <instrument id="Test1"> <title id="Test1">Test1</title> <bid>0</bid> <offer>0</offer> <trade>0</trade> <close>0</close> <b_time>11:59:00</b_time> <o_time>11:59:00</o_time> <time>11:59:00</time> <perc>0%</perc> <spot>0</spot> </instrument> </delayedquotes> and the code [Serializable, XmlRoot("delayedquotes"), XmlType("delayedquotes")] public class delayedquotes { [XmlElement("instrument")] public string instrument { get; set; } [XmlElement("title")] public string title { get; set; } [XmlElement("bid")] public double bid { get; set; } [XmlElement("spot")] public double spot { get; set; } [XmlElement("close")] public double close { get; set; } [XmlElement("b_time")] public DateTime b_time { get; set; } [XmlElement("o_time")] public DateTime o_time { get; set; } [XmlElement("time")] public DateTime time { get; set; } [XmlElement("hi")] public string hi { get; set; } [XmlElement("lo")] public string lo { get; set; } [XmlElement("offer")] public double offer { get; set; } [XmlElement("trade")] public double trade { get; set; } public delayedquotes() { } }

    Read the article

  • How to deploy a visual studio custom tool?

    - by Aen Sidhe
    Hello. I have a my own custom tool for Visual Studio 2008 SP1. It consists of 5 assemblies: 3 assemblies with code that used heavily in my other projects, 1 assembly-wrapper above VS2008 SDK and assembly with the tool. If I'd debug my tool from visual studio, using "Run external program" option with command line "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" and arguments "/ranu /rootsuffix Exp" all work perfectly. After that I trying to deploy it to my working VS copy, not to experimental hive doing: gacutil /i Asm1.dll for all my assemblies and doing RegAsm Asm1.dll only for assembly with custom tool. Neither of utils prints any error, all work as planned, even registry keys appeared. But my tool don't work even after PC restart. What did I do wrong? Wrapper looks like that: [ComVisible(true)] public abstract class CustomToolBase : IVsSingleFileGenerator, IObjectWithSite { #region IVsSingleFileGenerator Members int IVsSingleFileGenerator.DefaultExtension(out string pbstrDefaultExtension) { pbstrDefaultExtension = ".cs"; return 0; } int IVsSingleFileGenerator.Generate(string wszInputFilePath, string bstrInputFileContents, string wszDefaultNamespace, IntPtr[] rgbOutputFileContents, out uint pcbOutput, IVsGeneratorProgress pGenerateProgress) { GenerationEventArgs gea = new GenerationEventArgs( bstrInputFileContents, wszInputFilePath, wszDefaultNamespace, new ServiceProvider(Site as Microsoft.VisualStudio.OLE.Interop.IServiceProvider) .GetService(typeof(ProjectItem)) as ProjectItem, new GenerationProgressFacade(pGenerateProgress) ); if (OnGenerateCode != null) { OnGenerateCode(this, gea); } byte[] bytes = gea.GetOutputCodeBytes(); int outputLength = bytes.Length; rgbOutputFileContents[0] = Marshal.AllocCoTaskMem(outputLength); Marshal.Copy(bytes, 0, rgbOutputFileContents[0], outputLength); pcbOutput = (uint)outputLength; return VSConstants.S_OK; } #endregion #region IObjectWithSite Members void IObjectWithSite.GetSite(ref Guid riid, out IntPtr ppvSite) { IntPtr pUnk = Marshal.GetIUnknownForObject(Site); IntPtr intPointer = IntPtr.Zero; Marshal.QueryInterface(pUnk, ref riid, out intPointer); ppvSite = intPointer; } void IObjectWithSite.SetSite(object pUnkSite) { Site = pUnkSite; } #endregion #region Public Members public object Site { get; private set; } public event EventHandler<GenerationEventArgs> OnGenerateCode; [ComRegisterFunction] public static void Register(Type type) { using (var parent = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", true)) foreach (CustomToolRegistrationAttribute ourData in type.GetCustomAttributes(typeof(CustomToolRegistrationAttribute), false)) ourData.Register(x => parent.CreateSubKey(x), (x, name, value) => x.SetValue(name, value)); } [ComUnregisterFunction] public static void Unregister(Type type) { using (var parent = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", true)) foreach (CustomToolRegistrationAttribute ourData in type.GetCustomAttributes(typeof(CustomToolRegistrationAttribute), false)) ourData.Unregister(x => parent.DeleteSubKey(x, false)); } #endregion } My tool code: [ComVisible(true)] [Guid("55A6C192-D29F-4e22-84DA-DBAF314ED5C3")] [CustomToolRegistration(ToolName, typeof(TransportGeneratorTool))] [ProvideObject(typeof(TransportGeneratorTool))] public class TransportGeneratorTool : CustomToolBase { private const string ToolName = "TransportGeneratorTool"; public TransportGeneratorTool() { OnGenerateCode += GenerateCode; } private static void GenerateCode(object s, GenerationEventArgs e) { try { var serializer = new XmlSerializer(typeof (Parser.System)); using (var reader = new StringReader(e.InputText)) using (var writer = new StringWriter(e.OutputCode)) { Generator.System = (Parser.System) serializer.Deserialize(reader); Generator.System.Namespace = e.Namespace; Generator.GenerateSource(writer); } } catch (Exception ex) { e.Progress.GenerateError(ex.ToString()); } } } Resulting registry keys: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Generators] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\TransportGeneratorTool] @="TransportGeneratorTool" "CLSID"="{55a6c192-d29f-4e22-84da-dbaf314ed5c3}" "GeneratesDesignTimeSource"=dword:00000001 "GeneratesSharedDesignTimeSource"=dword:00000001

    Read the article

  • How to remove the xmlns:XSI and xmlns:XSD namespaces from the xml output of a webservice in .net fra

    - by Chetan
    HI, This is an old question, i have seen some solutions on this forum itself, but am trying to use webservices for the first time so please bear with me on this one. I have a webservice that returns XML in the following format <subs xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" msisdn="965xxxxxx"> <shortcode label="XXXX"> <channels> <channel> <id>442</id> <name>News</name> <billingperiod>7</billingperiod> <billingamount>3</billingamount> <lastbilling>4/14/2010 1:41:11 PM</lastbilling> </channel> <channel> <id>443</id> <name>News2</name> <billingperiod>7</billingperiod> <billingamount>3</billingamount> <lastbilling>4/14/2010 1:41:19 PM</lastbilling> </channel> </channels> </shortcode> </subs> I want the same XMl output without the xmlns:xsd and xmlns:xsi tags. I have tried the following solution that was suggested: Public Function GetSubscription(....) As String Dim namespaces As New XmlSerializerNamespaces namespaces.Add(String.Empty, String.Empty) Dim serializer As New XmlSerializer(SubsDetail.GetType) Dim sw As New System.IO.StringWriter Dim writer As New System.Xml.XmlTextWriter(sw) writer.Formatting = Formatting.None serializer.Serialize(writer, SubsDetail, namespaces) writer.Close() Return sw.toString() The result was that I got an xml in the following format: <string> <?xml version="1.0" encoding="utf-16"?><subs msisdn="965xxxx"> <shortcode label="XXXX"> <channels> <channel> <id>442</id> <name>News</name> <billingperiod>7</billingperiod> <billingamount>3</billingamount> <lastbilling>4/14/2010 1:41:11 PM</lastbilling> </channel> <channel> <id>443</id> <name>News2</name> <billingperiod>7</billingperiod> <billingamount>3</billingamount> <lastbilling>4/14/2010 1:41:19 PM</lastbilling> </channel> </channels> </shortcode> </subs> </string> Though the format of the xml is correct it is coming as string within the <string> tags. This is really driving me nuts. Can I get the output as xml without the outer string tags?

    Read the article

  • CodePlex Daily Summary for Monday, January 10, 2011

    CodePlex Daily Summary for Monday, January 10, 2011Popular ReleasesSense/Net Enterprise Portal & ECMS: SenseNet 6.0.1 Community Edition for .NET 4: SenseNet 6.0.1 Community Edition for .NET 4 with SQL CE 4.0 This half year we have been working quite fiercely to bring you the long-awaited release of Sense/Net 6.0. Download this Community Edition for .NET 4 Platform to see what we have been up to. These months we have worked on getting the WebCMS capabilities of Sense/Net 6.0 up to par. New features include: New, powerful page and portlet editing experience. HTML and CSS cleanup, new, powerful site skinning system. Upgraded, light...Agile Personal Body Of Knowledge: ????-????,???? v0.2.pdf: ????【????-????,????.pdf】???,?????????????????????????????,???????????,???????。 ??????????,??????????,????????,?????????! ????sina??:http://q.t.sina.com.cn/135484VSSpeedster - Parallel Builds for VS: VSSpeedster 1.1: - Parallel Builds with MSBuild integrated in Visual StudioBernie's Trackviewer: Bernie's Trackviewer Version 1.2: Redesigned user interface of main form Also displays waypoints which are not part of a track Can convert a route int a track Maximum age of cached maps can be setPeople's Note: People's Note 0.21: Replaced note viewer buttons with a menu bar to improve scrolling performance. Fixed database relocation on low-resolution devices; thanks to compaNet for reporting. Improved signin error messages. To install: copy the appropriate CAB file onto your WM device and run it.mytrip.mvc (CMS & e-Commerce): mytrip.mvc 1.0.51.0 beta2: WEB.mytrip.mvc 1.0.51.0 Web for install hosting System Requirements: NET 4.0, MSSQL 2008 or MySql (auto creation table to database) if .\SQLEXPRESS auto creation database (App_Data folder) SRC.mytrip.mvc 1.0.51.0 System Requirements: Visual Studio 2010 or Web Deweloper 2010 MSSQL 2008 or MySql (auto creation table to database) if .\SQLEXPRESS auto creation database (App_Data folder) Connector/Net 6.3.5, MVC3 RC WARNING For run and debug SRC.mytrip.mvc 1.0.51.0 download and install MVC3 RC...EnhSim: EnhSim 2.3.0: 2.3.0This release supports WoW patch 4.03a at level 85 To use this release, you must have the Microsoft Visual C++ 2010 Redistributable Package installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84 To use the GUI you must have the .NET 4.0 Framework installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992 - Changed how flame shoc...AutoLoL: AutoLoL v1.5.3: A message will be displayed when there's an update available Shows a list of recent mastery files in the Editor Tab (requested by quite a few people) Updater: Update information is now scrollable Added a buton to launch AutoLoL after updating is finished Updated the UI to match that of AutoLoL Fix: Detects and resolves 'Read Only' state on Version.xmlHawkeye - The .Net Runtime Object Editor: Hawkeye 1.2.4: [EDIT: 2010/01/10] In the case you are running an x86 Windows; please wait until Release 1.2.5 is made available: Hawkeye is broken on these OS. This is a maintenance release providing bug fixes. It comes in two flavors: Hawkeye.124.N2 is the standard .NET 2 build, was compiled with Visual Studio 2005 and can only inspect .NET 2 applications. Hawkeye.124.N4 is a .NET4 2 build, was compiled with Visual Studio 2010 and can only inspect .NET 4 applications. Please be patient until Release 1.3...Extended WPF Toolkit: Extended WPF Toolkit - 1.3.0: What's in the 1.3.0 Release?BusyIndicator ButtonSpinner ChildWindow ColorPicker - Updated (Breaking Changes) DateTimeUpDown - New Control Magnifier - New Control MaskedTextBox - New Control MessageBox NumericUpDown RichTextBox RichTextBoxFormatBar - Updated .NET 3.5 binaries and SourcePlease note: The Extended WPF Toolkit 3.5 is dependent on .NET Framework 3.5 and the WPFToolkit. You must install .NET Framework 3.5 and the WPFToolkit in order to use any features in the To...sNPCedit: sNPCedit v0.9d: added elementclient coordinate catcher to catch coordinates select a target (ingame) i.e. your char, npc or monster than click the button and coordinates+direction will be transfered to the selected row in the table corrected labels from Rot to Direction (because it is a vector)Ionics Isapi Rewrite Filter: 2.1 latest stable: V2.1 is stable, and is in maintenance mode. This is v2.1.1.25. It is a bug-fix release. There are no new features. 28629 29172 28722 27626 28074 29164 27659 27900 many documentation updates and fixes proper x64 build environment. This release includes x64 binaries in zip form, but no x64 MSI file. You'll have to manually install x64 servers, following the instructions in the documentation.StyleCop for ReSharper: StyleCop for ReSharper 5.1.14980.000: A considerable amount of work has gone into this release: Huge focus on performance around the violation scanning subsystem: - caching added to reduce IO operations around reading and merging of settings files - caching added to reduce creation of expensive objects Users should notice condsiderable perf boost and a decrease in memory usage. Bug Fixes: - StyleCop's new ObjectBasedEnvironment object does not resolve the StyleCop installation path, thus it does not return the correct path ...VivoSocial: VivoSocial 7.4.1: New release with bug fixes and updates for performance..NET Extensions - Extension Methods Library for C# and VB.NET: Release 2011.03: Added lot's of new extensions and new projects for MVC and Entity Framework. object.FindTypeByRecursion Int32.InRange String.RemoveAllSpecialCharacters String.IsEmptyOrWhiteSpace String.IsNotEmptyOrWhiteSpace String.IfEmptyOrWhiteSpace String.ToUpperFirstLetter String.GetBytes String.ToTitleCase String.ToPlural DateTime.GetDaysInYear DateTime.GetPeriodOfDay IEnumberable.RemoveAll IEnumberable.Distinct ICollection.RemoveAll IList.Join IList.Match IList.Cast Array.IsNullOrEmpty Array.W...EFMVC - ASP.NET MVC 3 and EF Code First: EFMVC 0.5- ASP.NET MVC 3 and EF Code First: Demo web app ASP.NET MVC 3, Razor and EF Code FirstVidCoder: 0.8.0: Added x64 version. Made the audio output preview more detailed and accurate. If the chosen encoder or mixdown is incompatible with the source, the fallback that will be used is displayed. Added "Auto" to the audio mixdown choices. Reworked non-anamorphic size calculation to work better with non-standard pixel aspect ratios and cropping. Reworked Custom anamorphic to be more intuitive and allow display width to be set automatically (Thanks, Statick). Allowing higher bitrates for 6-ch....NET Voice Recorder: Auto-Tune Release: This is the source code and binaries to accompany the article on the Coding 4 Fun website. It is the Auto Tuner release of the .NET Voice Recorder application.BloodSim: BloodSim - 1.3.2.0: - Simulation Log is now automatically disabled and hidden when running 10 or more iterations - Hit and Expertise are now entered by Rating, and include option for a Racial Expertise bonus - Added option for boss to use a periodic magic ability (Dragon Breath) - Added option for boss to periodically Enrage, gaining a Damage/Attack Speed buffJson.NET: Json.NET 4.0 Release 1: New feature - Added Windows Phone 7 project New feature - Added dynamic support to LINQ to JSON New feature - Added dynamic support to serializer New feature - Added INotifyCollectionChanged to JContainer in .NET 4 build New feature - Added ReadAsDateTimeOffset to JsonReader New feature - Added ReadAsDecimal to JsonReader New feature - Added covariance to IJEnumerable type parameter New feature - Added XmlSerializer style Specified property support New feature - Added ...New ProjectsAssimpXna: AssimpXna is a custom model importer for Xna 4.0 using the Open Asset Import Library (Assimp).ATCSim: This is an atc sim for a school projectAzure Role-Based Deployment: Azure Role-Based Deployment demonstrates how to use the CreateDeployment Windows Azure Service Management API to deploy an app from within a web role. This code can easily be ported to a worker role and thus included in the managment pack for a hosted service.CodeKata AltNet Hispano: Ejemplos de Code Kata usados por la comunidad AltNet Hispano.DataStoreCleaner: DataStoreCleaner clears "DataStore" folder which manages Windows Update History. It is useful for fixing WU error, or tune up Windows start-up. It's developed in C#.DS_HW2: dshw2EFT Calculator: EFT Calculator is an application that performs common cryptographic operations used in electronic funds transfer applications.Entity Visualizers: This project has debugger visualizers for several objects in the Entity Framework: EntityObject, EntityCollection, ObjectQuery and ObjectContext. Some of the source code is based on code from Julie Lerman's book "Programming Entity Framework".EzyCMS - Easy and Simple CMS made by ASP.Net MVC: EzyCMS makes both of end user and developer enjoy CMS benefit and extendability to perform requirements. The design principles: EASY TO USE, EASY TO EXTEND, FLEXIBLE AND PWOERFUL TECHNOLOGY: ASP.Net MVC2, NHibernate, StructureMap, JQueryFlatStore: Simple library to simplify storage of application data when a bulky dedicated database is cumbersome and unnecessaryGigantornis: Gigantornis is a tool for benchmarking your Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current server installation performs. This especially shows you how many requests per second your server installation is capable of serving.Gonte.Dal: Data access layer for NETLezatrus: Lezatrus is the open source project to help people find places to eat in Jakarta. It's developed in ASP.NET MVC using Razor and C#. It's the sample app for Pro ASP.NET MVC Coding Ninja facebook group.Moo: Moo is an object-to-object multi-mapper. It is able to use multiple different strategies (in a mix of convention, configuration, attributes and fluent calls) when mapping from one object to another.MvcXaml: A custom View Engine for ASP.NET MVC that allows Controller Action Methods to return dynamically generated images based on XAML markup.Perfect World Bot Development FrameWork: <empty yet>Silverlight motion detection: Motion detection using Silverlight 4 camera support and a simple motion detection algorithm.Small IT Business Manager: Small IT Business Manager is a tool being created keeping small-midsize IT companies in mind to allow them manage their day to day chores. Management Features planned: * Workers * Timesheets * Financial * HR * Basic Project Management * Invoicingsomething for testing: mot do an mau de test cac van de lien quan toi codeStructure Copier: This small program is supposed to copy tree structure of directory.TogNet: A small utility program to toggle between windows network adapters. Needed a program like this to switch between an external Wireless network and the corporate Lan network adapter.

    Read the article

  • CodePlex Daily Summary for Saturday, January 08, 2011

    CodePlex Daily Summary for Saturday, January 08, 2011Popular ReleasesExtended WPF Toolkit: Extended WPF Toolkit - 1.3.0: What's in the 1.3.0 Release?BusyIndicator ButtonSpinner ChildWindow ColorPicker - Updated (Breaking Changes) DateTimeUpDown - New Control Magnifier - New Control MaskedTextBox - New Control MessageBox NumericUpDown RichTextBox RichTextBoxFormatBar - Updated .NET 3.5 binaries and SourcePlease note: The Extended WPF Toolkit 3.5 is dependent on .NET Framework 3.5 and the WPFToolkit. You must install .NET Framework 3.5 and the WPFToolkit in order to use any features in the To...sNPCedit: sNPCedit v0.9d: added elementclient coordinate catcher to catch coordinates select a target (ingame) i.e. your char, npc or monster than click the button and coordinates+direction will be transfered to the selected row in the table corrected labels from Rot to Direction (because it is a vector)AutoLoL: AutoLoL v1.5.2: Implemented the Auto Updater Fix: Your settings will no longer be cleared with new releases of AutoLoL The mastery Editor and Browser now have their own tabs instead of nested tabs The Browser tab will only show the masteries matching ALL filters instead of just one Added a 'Browse' button in the Mastery Editor tab to open the Masteries Directory The Browser tab now shows a message when there are no mastery files in the Masteries Directory Fix: Fixed the Save As dialog again, for ...Ionics Isapi Rewrite Filter: 2.1 latest stable: V2.1 is stable, and is in maintenance mode. This is v2.1.1.25. It is a bug-fix release. There are no new features. 28629 29172 28722 27626 28074 29164 27659 27900 many documentation updates and fixes proper x64 build environment. This release includes x64 binaries in zip form, but no x64 MSI file. You'll have to manually install x64 servers, following the instructions in the documentation.StyleCop for ReSharper: StyleCop for ReSharper 5.1.14980.000: A considerable amount of work has gone into this release: Huge focus on performance around the violation scanning subsystem: - caching added to reduce IO operations around reading and merging of settings files - caching added to reduce creation of expensive objects Users should notice condsiderable perf boost and a decrease in memory usage. Bug Fixes: - StyleCop's new ObjectBasedEnvironment object does not resolve the StyleCop installation path, thus it does not return the correct path ...VivoSocial: VivoSocial 7.4.1: New release with bug fixes and updates for performance.SSH.NET Library: 2011.1.6: Fixes CommandTimeout default value is fixed to infinite. Port Forwarding feature improvements Memory leaks fixes New Features Add ErrorOccurred event to handle errors that occurred on different thread New and improve SFTP features SftpFile now has more attributes and some operations Most standard operations now available Allow specify encoding for command execution KeyboardInteractiveConnectionInfo class added for "keyboard-interactive" authentication. Add ability to specify bo....NET Extensions - Extension Methods Library for C# and VB.NET: Release 2011.03: Added lot's of new extensions and new projects for MVC and Entity Framework. object.FindTypeByRecursion Int32.InRange String.RemoveAllSpecialCharacters String.IsEmptyOrWhiteSpace String.IsNotEmptyOrWhiteSpace String.IfEmptyOrWhiteSpace String.ToUpperFirstLetter String.GetBytes String.ToTitleCase String.ToPlural DateTime.GetDaysInYear DateTime.GetPeriodOfDay IEnumberable.RemoveAll IEnumberable.Distinct ICollection.RemoveAll IList.Join IList.Match IList.Cast Array.IsNullOrEmpty Array.W...VidCoder: 0.8.0: Added x64 version. Made the audio output preview more detailed and accurate. If the chosen encoder or mixdown is incompatible with the source, the fallback that will be used is displayed. Added "Auto" to the audio mixdown choices. Reworked non-anamorphic size calculation to work better with non-standard pixel aspect ratios and cropping. Reworked Custom anamorphic to be more intuitive and allow display width to be set automatically (Thanks, Statick). Allowing higher bitrates for 6-ch....NET Voice Recorder: Auto-Tune Release: This is the source code and binaries to accompany the article on the Coding 4 Fun website. It is the Auto Tuner release of the .NET Voice Recorder application.BloodSim: BloodSim - 1.3.2.0: - Simulation Log is now automatically disabled and hidden when running 10 or more iterations - Hit and Expertise are now entered by Rating, and include option for a Racial Expertise bonus - Added option for boss to use a periodic magic ability (Dragon Breath) - Added option for boss to periodically Enrage, gaining a Damage/Attack Speed buffEnhSim: EnhSim 2.2.9 BETA: 2.2.9 BETAThis release supports WoW patch 4.03a at level 85 To use this release, you must have the Microsoft Visual C++ 2010 Redistributable Package installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84 To use the GUI you must have the .NET 4.0 Framework installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992 - Added in the Gobl...xUnit.net - Unit Testing for .NET: xUnit.net 1.7 Beta: xUnit.net release 1.7 betaBuild #1533 Important notes for Resharper users: Resharper support has been moved to the xUnit.net Contrib project. Important note for TestDriven.net users: If you are having issues running xUnit.net tests in TestDriven.net, especially on 64-bit Windows, we strongly recommend you upgrade to TD.NET version 3.0 or later. This release adds the following new features: Added support for ASP.NET MVC 3 Added Assert.Equal(double expected, double actual, int precision)...Json.NET: Json.NET 4.0 Release 1: New feature - Added Windows Phone 7 project New feature - Added dynamic support to LINQ to JSON New feature - Added dynamic support to serializer New feature - Added INotifyCollectionChanged to JContainer in .NET 4 build New feature - Added ReadAsDateTimeOffset to JsonReader New feature - Added ReadAsDecimal to JsonReader New feature - Added covariance to IJEnumerable type parameter New feature - Added XmlSerializer style Specified property support New feature - Added ...DbDocument: DbDoc Initial Version: DbDoc Initial versionASP .NET MVC CMS (Content Management System): Atomic CMS 2.1.2: Atomic CMS 2.1.2 release notes Atomic CMS installation guide N2 CMS: 2.1: N2 is a lightweight CMS framework for ASP.NET. It helps you build great web sites that anyone can update. Major Changes Support for auto-implemented properties ({get;set;}, based on contribution by And Poulsen) All-round improvements and bugfixes File manager improvements (multiple file upload, resize images to fit) New image gallery Infinite scroll paging on news Content templates First time with N2? Try the demo site Download one of the template packs (above) and open the proj...Mobile Device Detection and Redirection: 0.1.11.10: IMPORTANT CHANGESThis release changes the way some WURFL capabilities and attributes are exposed to .NET developers. If you cast MobileCapabilities to return some values then please read the Release Note before implementing this release. The following code snippet can be used to access any WURFL capability. For instance, if the device is a tablet: string capability = Request.Browser["is_tablet"]; SummaryNew attributes have been added to the redirect section: originalUrlAsQueryString If se...Wii Backup Fusion: Wii Backup Fusion 1.0: - Norwegian translation - French translation - German translation - WBFS dump for analysis - Scalable full HQ cover - Support for log file - Load game images improved - Support for image splitting - Diff for images after transfer - Support for scrubbing modes - Search functionality for log - Recurse depth for Files/Load - Show progress while downloading game cover - Supports more databases for cover download - Game cover loading routines improvedBlogEngine.NET: BlogEngine.NET 2.0: Get DotNetBlogEngine for 3 Months Free! Click Here for More Info 3 Months FREE – BlogEngine.NET Hosting – Click Here! If you want to set up and start using BlogEngine.NET right away, you should download the Web project. If you want to extend or modify BlogEngine.NET, you should download the source code. If you are upgrading from a previous version of BlogEngine.NET, please take a look at the Upgrading to BlogEngine.NET 2.0 instructions. To get started, be sure to check out our installatio...New Projects2011 Scripting Games: Track Changes for the 2011 Scripting Games to be hosted on PoshCode by the Microsoft Scripting Guys and the PowerShell community. ADO.NET Unit Testable Repository Generator: Generates a strongly-typed Object Context and POCO Entities from your EDMX file. Additionally a Repository and an abstract Unit Test for the Repository is created (with a mock for the ObjectContext and mock for the ObjectSets). Bases on the "ADO.NET C# POCO Entity Generator".AshpazKhone: ???AVAilable Rooms: AVAilable Rooms Can be used to show and book rooms on an exchange serverContentManager: Content Manger for SAP Kpro exports the data pool of a content-server by PHIOS-Lists (txt-files) into local binary files. Afterwards this files can be imported in a SAP content-repository . The whole List of the PHIOS Keys can also be downloaded an splitted in practical units.CSLauncher: CSLauncher is a small application providing a launching interface similar to Counter Strike's weapons selection menu. You can organize your favorite applications in CSLauncher in the order you wish, then launch them by remembering their numbers.DbMetadata: A simple lightweight library used to retrieve database metadata.DotNetSiemensPLCToolBoxLibrary: DotNetSiemensPLCToolBoxLibrary A Library for working with Siemens Step5 and Step7 Projects, connecting to S5 or S7 PLC's.EmptyX: EmptyX is a game developped with c# and xna for the XNA CHALLENGE in AlgeriaERASMUS: Erasmus šitFaceDeBouc: Simplebook, le nouveau Facebook CPE! Technlogies .NET Serveur: - BDD SQLServer - Logique métier - Web services Clients: - client lourd WPF - client léger ASP.NETFunction resolver: Application using .NET Expression trees to resolve a function for a set of numbersMLRobotic: Programme de gestion MLRobotic 2011 Sissa ProjectMS CRM Multiple Attachment Download Application: Microsoft Dynamics CRM 4.0 currently does not have a built in way for CRM Administrators to Export multiple attachments from the database and store it on a local directory on the Server or the local PC. This application allows you to do so.Open Data Publisher: Open Data Publisher is a C# MVC application that allows you to quickly and easily publish data from SQL Server tables and views using the OData protocol, and present data from OData and static sources to the public for download and exploration.OttawaZagreb1: Test projectPrague: ????? ?? ???? ??????PSSplunk: PSSplunk is a set of Powershell cmdlets that use the RESTFUL API provided by www.splunk.com The goal is provide access to all of Splunks configuration and search features from the CLI without having to have Splunk installed locally.Reactive C#: Reactive language extensions for C#SemanaWebcasts: Projeto para semana de webcasts.Steward: Personal StewardSVNUG.Tracker: SVNUG.Tracker is an example task tracking application used as a presentation project for the Sangamon Valley .NET User Group (svnug.com). The purpose of SVNUG.Tracker is to be a common problem domain for exercising new .NET technology. SVNUG.Tracker is written in C# 4.The Silverlight Cookbook - A Reference Application for Silverlight 4 LOB Apps: The Silverlight Cookbook is a .NET example application that demonstrates how to build a full-blown line-of-business app using the reference architecture explained at: http://www.dennisdoomen.net/search/label/Silverlight Vkontakte Wpf Client: This is a simple client for social network Vkontakte. It can send message to your friends, download audio files or play it,list user video. Also you can view user status and change yours.Windows Phone Multilingual Keyboard: Multilingual keyboard for Windows Phone 7WPF Controls & MVVM Practices: WPF Controls contains various controls that can be used in applications. Currently Featured * FilteredListBox (filter and selected items notification) * IsDirty functionality for a ViewModel model

    Read the article

  • CodePlex Daily Summary for Sunday, January 09, 2011

    CodePlex Daily Summary for Sunday, January 09, 2011Popular ReleasesEnhSim: EnhSim 2.2.10 BETA: 2.2.10 BETAThis release supports WoW patch 4.03a at level 85 To use this release, you must have the Microsoft Visual C++ 2010 Redistributable Package installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84 To use the GUI you must have the .NET 4.0 Framework installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992 - Removed the part...TweetSharp: TweetSharp v2.0.0.0 - Preview 7: Documentation for this release may be found at http://tweetsharp.codeplex.com/wikipage?title=UserGuide&referringTitle=Documentation. Note: This code is currently preview quality. Preview 7 ChangesFixes the regression issue in OAuth from Preview 6 Preview 6 ChangesMaintenance release with user reported fixes Preview 5 ChangesMaintenance release with user reported fixes Third Party Library VersionsHammock v1.0.6: http://hammock.codeplex.com Json.NET 3.5 Release 8: http://json.codeplex.comExtended WPF Toolkit: Extended WPF Toolkit - 1.3.0: What's in the 1.3.0 Release?BusyIndicator ButtonSpinner ChildWindow ColorPicker - Updated (Breaking Changes) DateTimeUpDown - New Control Magnifier - New Control MaskedTextBox - New Control MessageBox NumericUpDown RichTextBox RichTextBoxFormatBar - Updated .NET 3.5 binaries and SourcePlease note: The Extended WPF Toolkit 3.5 is dependent on .NET Framework 3.5 and the WPFToolkit. You must install .NET Framework 3.5 and the WPFToolkit in order to use any features in the To...sNPCedit: sNPCedit v0.9d: added elementclient coordinate catcher to catch coordinates select a target (ingame) i.e. your char, npc or monster than click the button and coordinates+direction will be transfered to the selected row in the table corrected labels from Rot to Direction (because it is a vector)AutoLoL: AutoLoL v1.5.2: Implemented the Auto Updater Fix: Your settings will no longer be cleared with new releases of AutoLoL The mastery Editor and Browser now have their own tabs instead of nested tabs The Browser tab will only show the masteries matching ALL filters instead of just one Added a 'Browse' button in the Mastery Editor tab to open the Masteries Directory The Browser tab now shows a message when there are no mastery files in the Masteries Directory Fix: Fixed the Save As dialog again, for ...Ionics Isapi Rewrite Filter: 2.1 latest stable: V2.1 is stable, and is in maintenance mode. This is v2.1.1.25. It is a bug-fix release. There are no new features. 28629 29172 28722 27626 28074 29164 27659 27900 many documentation updates and fixes proper x64 build environment. This release includes x64 binaries in zip form, but no x64 MSI file. You'll have to manually install x64 servers, following the instructions in the documentation.StyleCop for ReSharper: StyleCop for ReSharper 5.1.14980.000: A considerable amount of work has gone into this release: Huge focus on performance around the violation scanning subsystem: - caching added to reduce IO operations around reading and merging of settings files - caching added to reduce creation of expensive objects Users should notice condsiderable perf boost and a decrease in memory usage. Bug Fixes: - StyleCop's new ObjectBasedEnvironment object does not resolve the StyleCop installation path, thus it does not return the correct path ...VivoSocial: VivoSocial 7.4.1: New release with bug fixes and updates for performance.SSH.NET Library: 2011.1.6: Fixes CommandTimeout default value is fixed to infinite. Port Forwarding feature improvements Memory leaks fixes New Features Add ErrorOccurred event to handle errors that occurred on different thread New and improve SFTP features SftpFile now has more attributes and some operations Most standard operations now available Allow specify encoding for command execution KeyboardInteractiveConnectionInfo class added for "keyboard-interactive" authentication. Add ability to specify bo....NET Extensions - Extension Methods Library for C# and VB.NET: Release 2011.03: Added lot's of new extensions and new projects for MVC and Entity Framework. object.FindTypeByRecursion Int32.InRange String.RemoveAllSpecialCharacters String.IsEmptyOrWhiteSpace String.IsNotEmptyOrWhiteSpace String.IfEmptyOrWhiteSpace String.ToUpperFirstLetter String.GetBytes String.ToTitleCase String.ToPlural DateTime.GetDaysInYear DateTime.GetPeriodOfDay IEnumberable.RemoveAll IEnumberable.Distinct ICollection.RemoveAll IList.Join IList.Match IList.Cast Array.IsNullOrEmpty Array.W...EFMVC - ASP.NET MVC 3 and EF Code First: EFMVC 0.5- ASP.NET MVC 3 and EF Code First: Demo web app ASP.NET MVC 3, Razor and EF Code FirstVidCoder: 0.8.0: Added x64 version. Made the audio output preview more detailed and accurate. If the chosen encoder or mixdown is incompatible with the source, the fallback that will be used is displayed. Added "Auto" to the audio mixdown choices. Reworked non-anamorphic size calculation to work better with non-standard pixel aspect ratios and cropping. Reworked Custom anamorphic to be more intuitive and allow display width to be set automatically (Thanks, Statick). Allowing higher bitrates for 6-ch....NET Voice Recorder: Auto-Tune Release: This is the source code and binaries to accompany the article on the Coding 4 Fun website. It is the Auto Tuner release of the .NET Voice Recorder application.BloodSim: BloodSim - 1.3.2.0: - Simulation Log is now automatically disabled and hidden when running 10 or more iterations - Hit and Expertise are now entered by Rating, and include option for a Racial Expertise bonus - Added option for boss to use a periodic magic ability (Dragon Breath) - Added option for boss to periodically Enrage, gaining a Damage/Attack Speed buffAllNewsManager.NET: AllNewsManager.NET 1.2.1: AllNewsManager.NET 1.2.1 It is a minor update from version 1.2xUnit.net - Unit Testing for .NET: xUnit.net 1.7 Beta: xUnit.net release 1.7 betaBuild #1533 Important notes for Resharper users: Resharper support has been moved to the xUnit.net Contrib project. Important note for TestDriven.net users: If you are having issues running xUnit.net tests in TestDriven.net, especially on 64-bit Windows, we strongly recommend you upgrade to TD.NET version 3.0 or later. This release adds the following new features: Added support for ASP.NET MVC 3 Added Assert.Equal(double expected, double actual, int precision)...Json.NET: Json.NET 4.0 Release 1: New feature - Added Windows Phone 7 project New feature - Added dynamic support to LINQ to JSON New feature - Added dynamic support to serializer New feature - Added INotifyCollectionChanged to JContainer in .NET 4 build New feature - Added ReadAsDateTimeOffset to JsonReader New feature - Added ReadAsDecimal to JsonReader New feature - Added covariance to IJEnumerable type parameter New feature - Added XmlSerializer style Specified property support New feature - Added ...ASP .NET MVC CMS (Content Management System): Atomic CMS 2.1.2: Atomic CMS 2.1.2 release notes Atomic CMS installation guide N2 CMS: 2.1: N2 is a lightweight CMS framework for ASP.NET. It helps you build great web sites that anyone can update. Major Changes Support for auto-implemented properties ({get;set;}, based on contribution by And Poulsen) All-round improvements and bugfixes File manager improvements (multiple file upload, resize images to fit) New image gallery Infinite scroll paging on news Content templates First time with N2? Try the demo site Download one of the template packs (above) and open the proj...Mobile Device Detection and Redirection: 0.1.11.10: IMPORTANT CHANGESThis release changes the way some WURFL capabilities and attributes are exposed to .NET developers. If you cast MobileCapabilities to return some values then please read the Release Note before implementing this release. The following code snippet can be used to access any WURFL capability. For instance, if the device is a tablet: string capability = Request.Browser["is_tablet"]; SummaryNew attributes have been added to the redirect section: originalUrlAsQueryString If se...New Projects[OOBL] Projekt: Projekt iz kolegija Objektno Oblikovanje na Fakultetu Elektrotehnike i Racunarstva u Zagrebu.Aikido Glossary Reader: The Aikido Glossary Reader application makes it easier for Aikido students to search for Japanese terms used in martial arts training.AsyncFunc: AsyncFunc makes it easy to implement Event-based Asynchronous Pattern in .NET.BeijingAgricultureScience: ???????????BizTalk 5010 999 Generation: Create 5010 999 acknowledgement from the default 997 Generated by BizTalk ServerCheck if Knowledge Base fix is installed script: A handy script that checks if a knowledge base fix is installed or not.Coproject - rich project management: Coproject is a sample Silverlight application built on WCF RIA Services and Caliburn.Micro framework. It should demonstrate typical scenarios in business applications.DeskNote: DeskNote, makes taking and displaying a notes a lot easier. Have your notes on your desktop, write your notes in a text file and it will be automatically displayed on the desktop. DriveBackup: Are you tired of losing data? And do you sometimes forget to backup your data? Then this program is right for you, one-time setup with each new removable disk and after that Drive Backup instantly backs up your data in the background, without you pushing a button.ELSEngine XNA Game OS Engine: XNA Game Operating System Engine, designed to handle and make easy to use Interface, Interface assets, game screens, menus, controls, and more. Designed to be adaptable to XBOX or Windows, and to ANY style game.FermaProject: Team Ferma ProjectHalfNetworkNET: HalfNetworkNET makes it easier for <target user group> to <activity>. You'll no longer have to <activity>. It's developed in C++/CLILFS Record: LFS Record is a camera animation and video recording tool for Live for Speed users. It doesn't replace programs like Fraps 100%, but in most cases you'll find LFS Record allows a lot more freedom and control. It's developed in C# using WPF .net 4.MPC HC Web remote: A Web interface for Media Player Classic Home Cinema. Designed especialy for smart phones. Tested on Nokia 5800, but in theory it works on all smart phones with wifi & a browser.MSMS2CMP: Very simple application to swap particular strings (MSMS and CMPD number) in .mgf files (results from Mascot search engine used to identify proteins by mass spectrometry data). This might be a kind of example of using Regex and Text File I/OMy Now Playing to Twitter: A Simple WinForm Program that can get what user is playing in Winamp and send a status to Twitter. It's wrote in VB.Net but some source code is port of MiniTwitter(http://minitwitter.codeplex.com)and uses tagLib-sharp library(https://github.com/mono/taglib-sharp)RPM Header for .NET: RPM Header for .NET allows a developer to access the headers of RPM Package Manager files. It's developed in C#.SilverMenu: SilverMenu brings some of the menu functionality of Silverlight for Windows Phone 7 to the XNA world.Smartgrid Smartmeter GRYD: The GRYD smartgrid and Smartmeter project shows features and capabilities like Demand Response, Smart Home Appliance Load Curtailments, DMS integration with SCADA etc. GRYD, Gryd.org is to teach you the technology, this is only for personal use and not commercial use.WakeMeQt: WakeMeQt is a smart alarm for the Nokia n810 (and probably n800) internet tablets. Using a Nintendo Wii remote as the sensor it monitors your movements during sleep and chooses the optimal time to wake you. It's developed in C++ using the Qt framework.WPF SplitButton & MenuButton: This WPF SplitButton and MenuButton implementation aims to be more robust and visual attractive than the other WPF split buttons available on CodePlex and elsewhere. The code is based on David Anson's implementation made available on his blog.Y2XMas: Merry Chirstmas - Happy New Year 2011 software

    Read the article

  • Using an alternate JSON Serializer in ASP.NET Web API

    - by Rick Strahl
    The new ASP.NET Web API that Microsoft released alongside MVC 4.0 Beta last week is a great framework for building REST and AJAX APIs. I've been working with it for quite a while now and I really like the way it works and the complete set of features it provides 'in the box'. It's about time that Microsoft gets a decent API for building generic HTTP endpoints into the framework. DataContractJsonSerializer sucks As nice as Web API's overall design is one thing still sucks: The built-in JSON Serialization uses the DataContractJsonSerializer which is just too limiting for many scenarios. The biggest issues I have with it are: No support for untyped values (object, dynamic, Anonymous Types) MS AJAX style Date Formatting Ugly serialization formats for types like Dictionaries To me the most serious issue is dealing with serialization of untyped objects. I have number of applications with AJAX front ends that dynamically reformat data from business objects to fit a specific message format that certain UI components require. The most common scenario I have there are IEnumerable query results from a database with fields from the result set rearranged to fit the sometimes unconventional formats required for the UI components (like jqGrid for example). Creating custom types to fit these messages seems like overkill and projections using Linq makes this much easier to code up. Alas DataContractJsonSerializer doesn't support it. Neither does DataContractSerializer for XML output for that matter. What this means is that you can't do stuff like this in Web API out of the box:public object GetAnonymousType() { return new { name = "Rick", company = "West Wind", entered= DateTime.Now }; } Basically anything that doesn't have an explicit type DataContractJsonSerializer will not let you return. FWIW, the same is true for XmlSerializer which also doesn't work with non-typed values for serialization. The example above is obviously contrived with a hardcoded object graph, but it's not uncommon to get dynamic values returned from queries that have anonymous types for their result projections. Apparently there's a good possibility that Microsoft will ship Json.NET as part of Web API RTM release.  Scott Hanselman confirmed this as a footnote in his JSON Dates post a few days ago. I've heard several other people from Microsoft confirm that Json.NET will be included and be the default JSON serializer, but no details yet in what capacity it will show up. Let's hope it ends up as the default in the box. Meanwhile this post will show you how you can use it today with the beta and get JSON that matches what you should see in the RTM version. What about JsonValue? To be fair Web API DOES include a new JsonValue/JsonObject/JsonArray type that allow you to address some of these scenarios. JsonValue is a new type in the System.Json assembly that can be used to build up an object graph based on a dictionary. It's actually a really cool implementation of a dynamic type that allows you to create an object graph and spit it out to JSON without having to create .NET type first. JsonValue can also receive a JSON string and parse it without having to actually load it into a .NET type (which is something that's been missing in the core framework). This is really useful if you get a JSON result from an arbitrary service and you don't want to explicitly create a mapping type for the data returned. For serialization you can create an object structure on the fly and pass it back as part of an Web API action method like this:public JsonValue GetJsonValue() { dynamic json = new JsonObject(); json.name = "Rick"; json.company = "West Wind"; json.entered = DateTime.Now; dynamic address = new JsonObject(); address.street = "32 Kaiea"; address.zip = "96779"; json.address = address; dynamic phones = new JsonArray(); json.phoneNumbers = phones; dynamic phone = new JsonObject(); phone.type = "Home"; phone.number = "808 123-1233"; phones.Add(phone); phone = new JsonObject(); phone.type = "Home"; phone.number = "808 123-1233"; phones.Add(phone); //var jsonString = json.ToString(); return json; } which produces the following output (formatted here for easier reading):{ name: "rick", company: "West Wind", entered: "2012-03-08T15:33:19.673-10:00", address: { street: "32 Kaiea", zip: "96779" }, phoneNumbers: [ { type: "Home", number: "808 123-1233" }, { type: "Mobile", number: "808 123-1234" }] } If you need to build a simple JSON type on the fly these types work great. But if you have an existing type - or worse a query result/list that's already formatted JsonValue et al. become a pain to work with. As far as I can see there's no way to just throw an object instance at JsonValue and have it convert into JsonValue dictionary. It's a manual process. Using alternate Serializers in Web API So, currently the default serializer in WebAPI is DataContractJsonSeriaizer and I don't like it. You may not either, but luckily you can swap the serializer fairly easily. If you'd rather use the JavaScriptSerializer built into System.Web.Extensions or Json.NET today, it's not too difficult to create a custom MediaTypeFormatter that uses these serializers and can replace or partially replace the native serializer. Here's a MediaTypeFormatter implementation using the ASP.NET JavaScriptSerializer:using System; using System.Net.Http.Formatting; using System.Threading.Tasks; using System.Web.Script.Serialization; using System.Json; using System.IO; namespace Westwind.Web.WebApi { public class JavaScriptSerializerFormatter : MediaTypeFormatter { public JavaScriptSerializerFormatter() { SupportedMediaTypes.Add(new System.Net.Http.Headers.MediaTypeHeaderValue("application/json")); } protected override bool CanWriteType(Type type) { // don't serialize JsonValue structure use default for that if (type == typeof(JsonValue) || type == typeof(JsonObject) || type== typeof(JsonArray) ) return false; return true; } protected override bool CanReadType(Type type) { if (type == typeof(IKeyValueModel)) return false; return true; } protected override System.Threading.Tasks.Taskobject OnReadFromStreamAsync(Type type, System.IO.Stream stream, System.Net.Http.Headers.HttpContentHeaders contentHeaders, FormatterContext formatterContext) { var task = Taskobject.Factory.StartNew(() = { var ser = new JavaScriptSerializer(); string json; using (var sr = new StreamReader(stream)) { json = sr.ReadToEnd(); sr.Close(); } object val = ser.Deserialize(json,type); return val; }); return task; } protected override System.Threading.Tasks.Task OnWriteToStreamAsync(Type type, object value, System.IO.Stream stream, System.Net.Http.Headers.HttpContentHeaders contentHeaders, FormatterContext formatterContext, System.Net.TransportContext transportContext) { var task = Task.Factory.StartNew( () = { var ser = new JavaScriptSerializer(); var json = ser.Serialize(value); byte[] buf = System.Text.Encoding.Default.GetBytes(json); stream.Write(buf,0,buf.Length); stream.Flush(); }); return task; } } } Formatter implementation is pretty simple: You override 4 methods to tell which types you can handle and then handle the input or output streams to create/parse the JSON data. Note that when creating output you want to take care to still allow JsonValue/JsonObject/JsonArray types to be handled by the default serializer so those objects serialize properly - if you let either JavaScriptSerializer or JSON.NET handle them they'd try to render the dictionaries which is very undesirable. If you'd rather use Json.NET here's the JSON.NET version of the formatter:// this code requires a reference to JSON.NET in your project #if true using System; using System.Net.Http.Formatting; using System.Threading.Tasks; using System.Web.Script.Serialization; using System.Json; using Newtonsoft.Json; using System.IO; using Newtonsoft.Json.Converters; namespace Westwind.Web.WebApi { public class JsonNetFormatter : MediaTypeFormatter { public JsonNetFormatter() { SupportedMediaTypes.Add(new System.Net.Http.Headers.MediaTypeHeaderValue("application/json")); } protected override bool CanWriteType(Type type) { // don't serialize JsonValue structure use default for that if (type == typeof(JsonValue) || type == typeof(JsonObject) || type == typeof(JsonArray)) return false; return true; } protected override bool CanReadType(Type type) { if (type == typeof(IKeyValueModel)) return false; return true; } protected override System.Threading.Tasks.Taskobject OnReadFromStreamAsync(Type type, System.IO.Stream stream, System.Net.Http.Headers.HttpContentHeaders contentHeaders, FormatterContext formatterContext) { var task = Taskobject.Factory.StartNew(() = { var settings = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, }; var sr = new StreamReader(stream); var jreader = new JsonTextReader(sr); var ser = new JsonSerializer(); ser.Converters.Add(new IsoDateTimeConverter()); object val = ser.Deserialize(jreader, type); return val; }); return task; } protected override System.Threading.Tasks.Task OnWriteToStreamAsync(Type type, object value, System.IO.Stream stream, System.Net.Http.Headers.HttpContentHeaders contentHeaders, FormatterContext formatterContext, System.Net.TransportContext transportContext) { var task = Task.Factory.StartNew( () = { var settings = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, }; string json = JsonConvert.SerializeObject(value, Formatting.Indented, new JsonConverter[1] { new IsoDateTimeConverter() } ); byte[] buf = System.Text.Encoding.Default.GetBytes(json); stream.Write(buf,0,buf.Length); stream.Flush(); }); return task; } } } #endif   One advantage of the Json.NET serializer is that you can specify a few options on how things are formatted and handled. You get null value handling and you can plug in the IsoDateTimeConverter which is nice to product proper ISO dates that I would expect any Json serializer to output these days. Hooking up the Formatters Once you've created the custom formatters you need to enable them for your Web API application. To do this use the GlobalConfiguration.Configuration object and add the formatter to the Formatters collection. Here's what this looks like hooked up from Application_Start in a Web project:protected void Application_Start(object sender, EventArgs e) { // Action based routing (used for RPC calls) RouteTable.Routes.MapHttpRoute( name: "StockApi", routeTemplate: "stocks/{action}/{symbol}", defaults: new { symbol = RouteParameter.Optional, controller = "StockApi" } ); // WebApi Configuration to hook up formatters and message handlers // optional RegisterApis(GlobalConfiguration.Configuration); } public static void RegisterApis(HttpConfiguration config) { // Add JavaScriptSerializer formatter instead - add at top to make default //config.Formatters.Insert(0, new JavaScriptSerializerFormatter()); // Add Json.net formatter - add at the top so it fires first! // This leaves the old one in place so JsonValue/JsonObject/JsonArray still are handled config.Formatters.Insert(0, new JsonNetFormatter()); } One thing to remember here is the GlobalConfiguration object which is Web API's static configuration instance. I think this thing is seriously misnamed given that GlobalConfiguration could stand for anything and so is hard to discover if you don't know what you're looking for. How about WebApiConfiguration or something more descriptive? Anyway, once you know what it is you can use the Formatters collection to insert your custom formatter. Note that I insert my formatter at the top of the list so it takes precedence over the default formatter. I also am not removing the old formatter because I still want JsonValue/JsonObject/JsonArray to be handled by the default serialization mechanism. Since they process in sequence and I exclude processing for these types JsonValue et al. still get properly serialized/deserialized. Summary Currently DataContractJsonSerializer in Web API is a pain, but at least we have the ability with relatively limited effort to replace the MediaTypeFormatter and plug in our own JSON serializer. This is useful for many scenarios - if you have existing client applications that used MVC JsonResult or ASP.NET AJAX results from ASMX AJAX services you can plug in the JavaScript serializer and get exactly the same serializer you used in the past so your results will be the same and don't potentially break clients. JSON serializers do vary a bit in how they serialize some of the more complex types (like Dictionaries and dates for example) and so if you're migrating it might be helpful to ensure your client code doesn't break when you switch to ASP.NET Web API. Going forward it looks like Microsoft is planning on plugging in Json.Net into Web API and make that the default. I think that's an awesome choice since Json.net has been around forever, is fast and easy to use and provides a ton of functionality as part of this great library. I just wish Microsoft would have figured this out sooner instead of now at the last minute integrating with it especially given that Json.Net has a similar set of lower level JSON objects JsonValue/JsonObject etc. which now will end up being duplicated by the native System.Json stuff. It's not like we don't already have enough confusion regarding which JSON serializer to use (JavaScriptSerializer, DataContractJsonSerializer, JsonValue/JsonObject/JsonArray and now Json.net). For years I've been using my own JSON serializer because the built in choices are both limited. However, with an official encorsement of Json.Net I'm happily moving on to use that in my applications. Let's see and hope Microsoft gets this right before ASP.NET Web API goes gold.© Rick Strahl, West Wind Technologies, 2005-2012Posted in Web Api  AJAX  ASP.NET   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

< Previous Page | 6 7 8 9 10 11  | Next Page >