VS2012

.NET Framework 4.7–Released for All versions of Windows

May 3, 2017 .NET, .NET 4.7, .NET Framework, .NET Framework 4.7, ASP.NET, ASP.NET MVC, C#.NET, Caching, Cryptography, Extensions, Microsoft, Performance, Security, Visual Studio 2013, Visual Studio 2015, Visual Studio 2017, VisualStudio, VS2012, VS2013, VS2015, WCF, Web API, Web API v2.0, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, WinForms, WPF No comments

Microsoft has released next version of .NET Framework (do not get confused with .NET Core) .  Though the .NET Framework 4.7 was released as part of Windows 10 Creators Update a month ago. You can now install the .NET Framework 4.7 on other versions of Windows

Download the: .NET Framework 4.7  – Web installer  |  Offline Installer

.NET Framework 4.7 Developer Pack  In order to add support for .NET Framework 4.7 in Visual Studio 2012 or later we need to install Developer Pack.

Windows Versions and Support:

The .NET Framework 4.7 is supported on the following Windows versions:

  • Windows 10 Creators Update (included in-box)
  • Windows 10 Anniversary Update
  • Windows 8.1
  • Windows 7 SP1

The .NET Framework 4.7 is supported on the following Windows Server versions:

  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2 SP1

New Features in .NET Framework 4.7:

On a high-level below are the set of new features introduced in following areas:

Core

Networking  Default operating system support for TLS protocols*

ASP.NET

  • Object Cache Extensibility  (plug in new implementations of an object cache for an ASP.NET application by using the new ICacheStoreProvider interface. )
  • Memory monitoring (Developers can now write their own memory monitors to replace the default by using the ApplicationMonitors.MemoryMonitor property.)
  • Memory Limit Reactions. (Developers can now replace or supplement the default behavior by subscribing IObserver implementations to the application’s memory monitor.

Windows Communication Foundation (WCF) 

  • Ability to configure the default message security settings to TLS 1.1 or TLS 1.2
  • Improved reliability of WCF applications and WCF serialization

Windows FormsHigh DPI support

Windows Presentation Foundation (WPF)

  • Support for a touch/stylus stack based on Windows WM_POINTER messages
  • New implementation for WPF printing APIs

Also improvements in :

  • High DPI support for Windows Forms applications on Windows 10
  • Touch support for WPF applications on Windows 10
  • Enhanced cryptography support
  • Support for C# 7 and VB 15, including ValueTuple
  • Support for .NET Standard 1.6
  • Performance and reliability improvements

 

Additional References:

Back to Basics : Singleton Design Pattern using System.Lazy type

June 25, 2015 .NET, .NET Framework, .NET Framework 4.5, .NET Framework 4.5.2, .NET Framework 4.6, Back-2-Bascis, BCL(Base Class Library), C#.NET, Codes, Design Patterns, KnowledgeBase, Microsoft, Portable Class Library, Visual Studio 2013, Visual Studio 2015, VisualStudio, VS2010, VS2012, VS2013, VS2015, Windows No comments

This article takes you to a simpler/alternative approach in making a Singleton Design Pattern implementation using System.Lazy class rather that using our traditional approach.

Singleton Design Pattern implementation without lazy initialization:

  • This code is thread safe enabled
 /// <summary>
    /// Singleton class 
    /// </summary>
    public class AppConfig
    {

        private AppConfig()
        {

        }

        /// <summary>
        /// Gets the current date time.
        /// </summary>
        /// <value>
        /// The current date time.
        /// </value>
        public DateTime CurrentDateTime
        {
            get
            {
                return DateTime.Now;
            }
        }
        /// <summary>
        /// The _config
        /// </summary>
        private static AppConfig _config;

        /// <summary>
        /// The pad lock for maintaining a thread lock.
        /// </summary>
        private static readonly Object padLock = new object();

        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <value>
        /// The instance.
        /// </value>
        public static AppConfig Instance
        {
            get
            {

                if (_config == null)
                {
                    lock (padLock) // making thread-safe
                    {
                        //{
                        if (_config == null) //second level check to make sure, within the short span, another concurent thread didnt initialize the object. 
                        {
                            _config = new AppConfig();
                        }
                    }
                }
                //}

                return _config;
            }
        }
    }

This approach ensures that only one instance is created and only when the instance is needed. Also, the variable is declared to be volatile to ensure that assignment to the instance variable completes before the instance variable can be accessed. Lastly, this approach uses a padLock instance to lock on, rather than locking on the type itself, to avoid deadlocks.

Another variant using Lazy initialization using static constructor and thread safe since initialization is handled during runtime within readonly variable declaration.  This will be thread-safe any ways.

 /// <summary>
    /// a Simpler version of Singleton class with lazy initialization.
    /// </summary>
    public class AppConfigLazy1
    {
        // static holder for instance, will not get initialized until first use, due to static contructor.
        private static readonly AppConfigLazy1 _instance = new AppConfigLazy1();

        /// <summary>
        /// Prevents a default instance of the <see cref=&quot;AppConfigLazy1&quot;/> class from being created.
        /// </summary>
        private AppConfigLazy1()
        {

        }

        /// <summary>
        /// for Lazy Initializes the <see cref=&quot;AppConfigLazy1&quot;/> class.
        /// </summary>
        static AppConfigLazy1()
        {

        }


        public static AppConfigLazy1 Instance
        {
            get
            {
                return _instance;
            }
        }
    }

Now with .NET 4.0 onwards there is a better way of doing this using .NET Runtime methods using System.Lazy type. System.Lazy type is mainly used in Entity Framework context, but we can use the same in implementing lazy loading where ever we have to deal with memory intensive object or collection of objects.

System.Lazy type  guarantees thread-safe lazy-construction. (By default, all public and protected members of the Lazy class are thread safe and may be used concurrently from multiple threads.)

.NET Framework Support in: 4.6, 4.5, 4
/// <summary>
    /// a Simpler version of Singleton class with lazy initialization.
    /// </summary>
    public class AppConfigLazy2
    {
        // static holder for instance, need to use lambda to construct since constructor private
        private static readonly Lazy<AppConfigLazy2> _instance = new Lazy<AppConfigLazy2>(() => new AppConfigLazy2());

        /// <summary>
        /// Prevents a default instance of the <see cref=&quot;AppConfigLazy2&quot;/> class from being created.
        /// </summary>
        private AppConfigLazy2()
        {

        }
        
        public static AppConfigLazy2 Instance
        {
            get
            {
                return _instance.Value;
            }
        }


        /// <summary>
        /// Gets the current date time.
        /// </summary>
        /// <value>
        /// The current date time.
        /// </value>
        public DateTime CurrentDateTime
        {
            get
            {
                return DateTime.Now;
            }
        }
    }
    

That’s more than one way doing Singleton Pattern Implementation right?, hope that was helpful to you  Some reference links are given below:

NuGet Package – Unity.WebAPI

January 5, 2015 .NET, .NET Framework, .NET Framework 4.5, .NET Framework 4.5.2, ASP.NET, ASP.NET 4.5, ASP.NET MVC, Microsoft, NuGet, Package Manager, VisualStudio, VS2010, VS2012, VS2013, Web API No comments

Today I came across this interesting Nuget Package for creating ASP.NET Web API project with Microsoft Unity Dependency Injection container.

  • It is pretty simple to configure and install on your existing Web API project or new ones.

Inorder to use it, use the respective NUGET package from below links:

To install Unity.WebAPI, run the following command in the Package Manager Console

PM> Install-Package Unity.WebAPI -Version 0.10.0

To install Unity.WebAPI, run the following command in the Package Manager Console

PM> Install-Package Unity.WebAPI

You can find out more about Unity.WebAPI by visiting – http://devtrends.co.uk/blog/introducing-the-unity.webapi-nuget-package

Windows Phone Screen Sharing/Mirroring to PC

July 4, 2014 KnowledgeBase, Mirror Casting, Visual Studio 2013, VisualStudio, VS2012, VS2013, Windows, Windows 8, Windows 8.1, Windows Phone, Windows Phone 8, Windows Phone 8.0 SDK, Windows Phone Development, Windows Phone SDK, Windows Store Development No comments

Being mobile developer and strong follower of Mobile related technologies, always admire to  demonstrate my work to my friends and colleagues.  All this time I was fancy about iOS Mirroring provided through apps Reflector and Air Server.   With help of these tools we used to mirror our iPad/iPhone to be mirrored to a Windows/Mac and then project that to large screen using a Projector. These tools seamlessly mirror your activities on iPad/iPhone and audiences get a live view of the application running in a Live Phone.  Advantage is you don’t have to rely on iOS Simulators coming with XCode and iOS SDK alone to demo your applications.

Coming to Windows Phone, we can have the same through a Wired Connection. Probably in recent Microsoft demos you might have fancied how the presenters used to share their Windows Phone activities and features from their live phones. You don’t have to envy them, it is available for our use now.

Microsoft has provided an application to be installed on Windows/Mac or Tablets and through a Wired or Wifi.

Download Project My Screen App from Microsoft

It is pretty simple to use:

1. Just install the app on your Windows/Mac

2. Connect your Windows Phone to USB (wired)

3, Launch “Project My Screen App” from Start Menu. It will detect your phone and your will will be prompted to Accept the screen sharing. Click on ‘Yes’, and look how amazing it is to share your screen on PC.

PS: There is a caveat you all need to know, you cannot share DRM protected contents through this feature. 

PMS_01

Enjoy your live demos


Visual Studio 2012 Update 4–Released

November 13, 2013 .NET, .NET Framework, .NET Framework 4.5, Microsoft, Updates, VisualStudio, VS2012 No comments

Microsoft has today released the final RTW(Release-To-Web) version of Visual Studio 2012 Update 4 .  This update is the latest in a cumulative series of feature additions and bug fixes for Visual Studio 2012.

Download:  Visual Studio 2012 Update 4 ( Web Install | Offline ISO )

Visual Studio Team Foundation Server 2012 with Update 4

Visual Studio Team Foundation Server Express 2012 with Update 4

For information about the update see the  Visual Studio Update KB Article.

WCF RIA Services V1.0 SP2–available

November 7, 2013 .NET, .NET Framework, ASP.NET, Microsoft, RIA Services, Silverlight, Visual Studio 2013, VisualStudio, VS2010, VS2012, WCF, Windows, Windows 7, Windows 8, Windows 8.1 No comments

Latest update for WCF RIA Services v 1.0 includes support for Windows 8.1 and VS2010, 2012, 2013.

Version: 4.1.61829.0            |        Date Published:  11/5/2013

Little about WCF RIA Services

    “ WCF RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier. “
    [Quote – Microsoft]

Download WCF RIA Services v1.0 SP2