Tag Archives: .net technology

12 Online C# Tutorials For 2018

Are you a beginner developer or someone who’s keen to learn programming languages? To mention, C# is great for learning. Unlike C++, for example, C# provides automatic memory management, and it also offers solid Type Safety in comparison to JavaScript and node.js. C# has huge libraries of base class; the .NET framework has several hundreds of libraries to work with the file system, manage security, and much more.

12 Online C# Tutorials For 2018

With the release of .NET Core, it appears that C# and .NET Core would be in a huge demand in 2018.

Whether you are learning C# for the first time or enhancing your C# expertise, here we share with you 12 best tutorials for both the beginners and experienced programmers to enrich their knowledge.

12 of the Best C# Tutorials

1. Lynda.com

Their topics include core language elements like data types, variables, and constants. There are 5 challenge videos which let you test yourself, along with another 5 videos with explained answers.

Key Topics:

To work with loops

To builds functions

To catch errors

To manage resources with t garbage collector

2. C# Station

They have a set of lessons for a beginner to intermediate-level developers.

Key Topics:

Expressions, Types, and Variables

Namespaces

Overview of Classes

Indexers and Attributes

To work with Nullable types

3. Tutorials Teacher

This site features free online tutorials on web technology for the beginners and professionals alike. In addition to C#, they teach ASP.NET MVC, LINQ, jQuery, AngularJS, JavaScript, or Node.js.

Key Topics:

Data types, classes, and variables

Switches and loops

Strings and arrays

Stream I/O

4. Deccansoft

Every concept is explained in details using different walkthroughs and practical methods. It is recommended to have a practical knowledge of any one programming language before you go for this course.

Key Topics:

.NET Framework

Common Language Runtime concepts

To build a standard GUI for Windows-based applications with the use of WinForms.

5. edX

This tutorial originates from edX, an online educational services provider which offers some courses to top universities and colleges. This is not a starter’s course and needs you to have a prior understanding of the programming language.

Key Topics:

C# syntax

Fundamentals of C# language

Object-oriented programming

Overview of .NET Framework

6. Udemy

This happens to be one of the largest online educational platforms with thousands of courses. There are many video tutorials on C# programming, but the best ones aren’t free and charge a reasonable fee.

Key Topics:

Loops, arrays, and structures

Coding beginner projects

To make the right approach

7. LearnCS.org

A free online tutorial for C#; the website is dedicated exclusively to teaching C#.

Key Topics:

Variables and types

Strings, and loops

Methods

Classes and class properties

8. Microsoft Virtual Academy

This C# tutorial offers 24 practical and easy episodes. Besides the fundamentals of C#, this course also covers the tools, tips to write code, debug features, explore customizations, and much more.

Key Topics:

To create and understand C# program

Understand Data types and Variables

Understand Arrays

Work with Strings

Learn to work with Date and Time data

9. Abbot – C# Tutorial

They have tutorials which cover the basics like loops, strings, and arrays and then offers more complicated stuff like delegates, namespaces, and collections.

Key Topics:

Data types

Lexical structure

Strings

Flow control

Delegates

Namespaces

Collections

10. Channel 9

With their “Jump Start” program they provide every topic with examples.

Key Topics:

Introduction to oriented programming

Basics of a managed language

Why C# is best for OOP

C# Syntax

11. SoloLearn

Their tutorials are fun and teach C# concepts through short interactive texts, games, and quizzes. The instructors offer a hands-on approach and that is the best way to learn codes and practicing them.

Key topics:

Basic concepts like variables, printing, and arithmetic operators

Loops and methods

Arrays and strings

Inheritance, polymorphism, and generics

12. Microsoft – Getting started with C#

This is a nice little tutorial from Microsoft and is unique and tailored. You can select your degree of difficulty before you begin with selecting if you are a beginner or experienced.

Key Topics:

Write your first hello world program

Strings, loops, dates, and times

Arrays, collections, and calling methods

Namespaces

Test your code and troubleshooting

Besides the above mentions, there are some other websites offering C# courses online like Coursera – Beginning Game Programming with C#, 26. Certification Guru – C# .NET Programming, Complete C# Tutorial just to name a few.

Once you’ve become an expert at C#, you can need to check out other resources with an advanced tutorial.

With this, we conclude.

Keep coding!

If you want to enhance yourself in Dot Net Course and improve yourself through Dot NET training program; our institute, CRB Tech Solutions would be of great help and support. We give a well-structured program for the best Dot Net Course. Among many reputed institutes of dot net training and placement in Pune.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

How Can .NET Core 2.0 Act As Saviour When there is Dot NET Core DLL Hell

If you know that .NET came with a promise, about 15 years ago to eliminate DLL hell. It was then a big issue to register COM DLL files. And today with mixing, NET Standard, .NET Core and .NET Framework projects have created a new DLL hell.

Can .NET Core 2.0 Act As Saviour When there is Dot NET Core DLL Hell

Here let’s discuss a DLL hell problem.

Suppose there is a simple NetStandard library with some simple classes in it that are used by an ASP.NET Core MVC app and a .NET Framework console application.

There is also System.IO 4.3.0, the latest version.

Other Class Library

In a console app, there is a bunch of classes and business logic. And it is kept in a separate class library. This .NET Framework library also references the CoreLibrary project which is.NETStandard 1.5. And the problem starts, where there are several wonderful messages like this for basic system DLLs.

2> Consider app.config to remap of assembly “System.IO, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” from Version “4.1.1.0” [] to Version “4.1.2.0” [C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\\net461\ref\System.IO.dll] to solve conflict and get rid of warning.

2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2099,5): warning MSB3836: The explicit binding redirect on “System.IO, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” conflicts with an auto-generated binding re-direct. You need to remove it from the application configuration file or disable autogenerated binding redirects. The build will replace it with: “<bindingRedirect oldVersion=”0.0.0.0-4.1.2.0″ newVersion=”4.1.2.0″ xmlns=”urn: schemas-Microsoft-com:asm.v1″ />”.

DLL Version Hell

The .NETStandard class library uses System.IO 4.3.0, and so also the Framework class library.

<Reference Include=”System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL”>

<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>

</Reference>

Then… why the DLL hell there are errors about 4.1.1 and 4.1.2?

It could be that the System.IO 4.3.0 package has different version DLLs in it? You need to recheck. And on looking into the System.IO.dll that gets copied to the bin folder after a build… it says 4.6.24705.1, just like the one in “..\packages\System.IO.4.3.0\lib\net462\System.IO.dll”.

And this is a real cruel deal. Who’s on first? What’s on second?

Why there are 4 Versions of the Same DLL/Package?

Let’s recap; there were versions 4.1.1, 4.1.2, 4.3.0, and 4.6.24705.1. Except, the only one which is actually seen is v4.6 stuck in a v4.3 folder. But why it shows 4.1.1 and 4.1.2 build errors.

Does it make any sense?

Why the .NET team has a v4.6 dll in a v4.3 NuGet package which is really v4.1.1.

It could be the effect of mixing.NETStandard and .NET Framework projects together are the problem.

How .NET Core 2.0 helps?

With the emergence of .NET Core 2.0, you need to switch all the projects. Initially, you were made to use full .NET Framework due to a few NuGet packages that were unavailable for NetStandard.

The false support for .NET Framework packages from a .NET Core application seems an easy solution.

Summary

With different projects that reference each other with conflicts in dependencies, it becomes complicated. The complexity of working with.NET Framework, netcoreapp, and.NETStandard all together is really complicated.

We can hope that .NET Core 2.0 solves the current set of issues.

With this, we conclude. This blog is an adaptation of a blog in Stackify. Keep coding!

If you want to enhance yourself in Dot Net Course and improve yourself through Dot NET training program; our institute, CRB Tech Solutions would be of great help and support. We give a well-structured program for the best Dot Net Course. Among many reputed institutes in Pune, CRB Tech has created a niche for itself.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

How To Test Logging In ASP.NET Core

In some cases, like analysis of problems in production, logging is really essential. Even you would like to test that your logging really works.

Testing_Logging_In_ASP_DOT_NET_Core

Let’s take the following function:

Public void DoSomething(int input)

{

_logger.LogInformation(“Doing something…”);

try

{

// do something that might result in an exception

var result = 10 / input;

}

catch (Exception ex)

{

// swallow but log the exception

_logger.LogError(ex, “An error occurred doing something.”, input);

}

public void DoSomething(int input)

{

_logger.LogInformation(“Doing something…”);

try

{

// do something that might result in an exception

var result = 10 / input;

}

catch (Exception ex)

{

// swallow but log the exception

_logger.LogError(ex, “An error occurred doing something.”, input);

}

}

We can assume that with an occurrence of this exception, it’s costing the company good amount of money. Hence it is good to know about it to solve a problem. From a developer’s point of view, the LogError method has the business Importance. And to be sure about it’s working right, there must be automated tests.

Now, consider how to test this code when the _logger case in question is an ASP.NET Core ILogger<T> type, input like as it is:

public class SomeService

{

private readonly ILogger<SomeService> _logger;

public SomeService(ILogger<SomeService> logger)

{

_logger = logger;

}

// methods

}

public class SomeService

{

private readonly ILogger<SomeService> _logger;

public SomeService(ILogger<SomeService> logger)

{

_logger = logger;

}

// methods

}

Now the question is how to test this scenario! You can’t call the method and then observe SomeService’s state to see if it is working. The only way to confirm in a unit test is to pass in your own implementation of ILogger<SomeService> into SomeService, and then find out if this instance was called by the DoSomething method. One way to do this is to use a mocking library like Moq, as shown below:

public void LogsErrorWhenInputIsZero()

{

var mockLogger = new Mock<ILogger<SomeService>>();

var someService = new SomeService(mockLogger.Object);

someService.DoSomething(0);

// Option 1: Try to verify the actual code that was called.

// Doesn’t work.

mockLogger.Verify(l => l.LogError(It.IsAny<Exception>(), It.IsAny<string>(), 0));

}

public void LogsErrorWhenInputIsZero()

{

var mockLogger = new Mock<ILogger<SomeService>>();

var someService = new SomeService(mockLogger.Object);

someService.DoSomething(0);

// Option 1: Try to verify the actual code that was called.

// Doesn’t work.

mockLogger.Verify(l => l.LogError(It.IsAny<Exception>(), It.IsAny<string>(), 0));

}

To mention, this approach fails as there is no LogError method on ILogger<T>, which is the LoggerExtension. This is the main reason why unit testing logging is difficult in ASP.NET Core.

A solution to this is to open a code for the logger extensions and find out what non-extension method is finally executed on ILogger. This would lead to a test like this one:

public void LogsErrorWhenInputIsZeroTake2()

{

var mockLogger = new Mock<ILogger<SomeService>>();

var someService = new SomeService(mockLogger.Object);

someService.DoSomething(0);

// Option 2: Look up what instance method the extension method actually calls:

//https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Abstractions/LoggerExtensions.cs#L342

// Mock the underlying call instead.

// Works but is ugly and brittle

mockLogger.Verify(l => l.Log(LogLevel.Error, 0, It.IsAny<FormattedLogValues>(), It.IsAny<Exception>(),

It.IsAny<Func<object, Exception, string>>()));

}

public void LogsErrorWhenInputIsZeroTake2()

{

var mockLogger = new Mock<ILogger<SomeService>>();

var someService = new SomeService(mockLogger.Object);

someService.DoSomething(0);

// Option 2: Look up what instance method the extension method actually calls:

// https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Abstractions/LoggerExtensions.cs#L342

// Mock the underlying call instead.

// Works but is ugly and brittle

mockLogger.Verify(l => l.Log(LogLevel.Error, 0, It.IsAny<FormattedLogValues>(), It.IsAny<Exception>(),

It.IsAny<Func<object, Exception, string>>()));

}

But you might have to mock calls that don’t even exist in the method we’re testing.

But every problem has a solution finder. So finally a trouble-shooter solved it by mentioning the need to create own version of ILogger<T> and give it with its own implementation of the method that has to be checked.

As instance methods are used before extensions methods, this would rather override the extension method in the test code. Thus, will appear the implementation:

public void LogsErrorWhenInputIsZeroTake3()

{

var fakeLogger = new FakeLogger();

var someService = new SomeService(fakeLogger);

someService.DoSomething(0);

// Option 3: Create your own instance of ILogger<T> that has a non-extension version of the method

// Doesn’t work, unless you change system under test to take in a FakeLogger (which is useless)

Assert.NotNull(FakeLogger.ProvidedException);

Assert.NotNull(FakeLogger.ProvidedMessage);

}

private class FakeLogger : ILogger<SomeService>

{

public static Exception ProvidedException { get; set; }

public static string ProvidedMessage { get; set; }

public static object[] ProvidedArgs { get; set; }

public IDisposable BeginScope<TState>(TState state)

{

return null;

}

public bool IsEnabled(LogLevel logLevel)

{

return true;

}

public void Log<TState>(LogLevel, EventId, TState state, Exception, Func<TState, Exception, string> formatter)

{

}

public void LogError(Exception ex, string message, params object[] args)

{

ProvidedException = ex;

ProvidedMessage = message;

ProvidedArgs = args;

}

}

public void LogsErrorWhenInputIsZeroTake3()

{

var fakeLogger = new FakeLogger();

var someService = new SomeService(fakeLogger);

someService.DoSomething(0);

// Option 3: Create your own instance of ILogger<T> that has a non-extension version of the method

// Doesn’t work, unless you change system under test to take in a FakeLogger (which is useless)

Assert.NotNull(FakeLogger.ProvidedException);

Assert.NotNull(FakeLogger.ProvidedMessage);

}

private class FakeLogger : ILogger<SomeService>

{

public static Exception ProvidedException { get; set; }

public static string ProvidedMessage { get; set; }

public static object[] ProvidedArgs { get; set; }

public IDisposable BeginScope<TState>(TState state)

{

return null;

}

public bool IsEnabled(LogLevel logLevel)

{

return true;

}

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception, Func<TState, Exception, string> formatter)

{

}

public void LogError(Exception ex, string message, params object[] args)

{

ProvidedException = ex;

ProvidedMessage = message;

ProvidedArgs = args;

}

}

Even now you could assume that DoSomething is still calling the method LogError on ILogger<T>, Yet the extension method will be used because ILogger<T> doesn’t have an instance method that it could match. The only solution is to change the SomeService method to accept a FakeLogger, instead of an ILogger<T>, but even that doesn’t come as a real solution.

So what could be done?

The actual problem is we are dependent on types which are outside our control, and the types are using static methods which can’t be decoupled in tests. To attain loose coupling in our applications, we have to bring together dependencies on specific implementations by working with interfaces that can be controlled. This is a segment of the Interface Segregation Principle (ISP).

Now, some developers will counter because it’s not an implementation and even its part of the framework that we depend upon. But to accept the fact that, ILogger<T> isn’t an implementation, it’s only a use of extension methods and makes testing difficult. The best way to address the problem is with the use of an adapter.

You can start with the minimal interface which your client code needs. You don’t need to create one adapter for all but with every variation of method found on LoggerExtensions. Most applications won’t need all of them, so include the ones you require.

public interface ILoggerAdapter<T>

{

// add just the logger methods your app uses

void LogInformation(string message);

void LogError(Exception ex, string message, params object[] args);

}

public interface ILoggerAdapter<T>

{

// add just the logger methods your app uses

void LogInformation(string message);

void LogError(Exception ex, string message, params object[] args);

}

You can implement the adapter easily by passing in the implementation type it’s using. In this case, the ILogger<T> type and its extension methods:

public class LoggerAdapter<T> : ILoggerAdapter<T>

{

private readonly ILogger<T> _logger;

public LoggerAdapter(ILogger<T> logger)

{

_logger = logger;

}

public void LogError(Exception ex, string message, params object[] args)

{

_logger.LogError(ex, message, args);

}

public void LogInformation(string message)

{

_logger.LogInformation(message);

}

}

public class LoggerAdapter<T> : ILoggerAdapter<T>

{

private readonly ILogger<T> _logger;

public LoggerAdapter(ILogger<T> logger)

{

_logger = logger;

}

public void LogError(Exception ex, string message, params object[] args)

{

_logger.LogError(ex, message, args);

}

public void LogInformation(string message)

{

_logger.LogInformation(message);

}

}

At this point, you refract your service to remove the ILogger<T> dependency and instead use an ILoggerAdapter<T>. And next writing a text to verify that the error is logged properly becomes easy:

public void LogsErrorWhenInputIsZero()

{

var mockLogger = new Mock<ILoggerAdapter<SomeOtherService>>();

var someOtherService = new SomeOtherService(mockLogger.Object);

someOtherService.DoSomething(0);

mockLogger.Verify(l => l.LogError(It.IsAny<Exception>(), It.IsAny<string>(), 0));

}

public void LogsErrorWhenInputIsZero()

{

var mockLogger = new Mock<ILoggerAdapter<SomeOtherService>>();

var someOtherService = new SomeOtherService(mockLogger.Object);

someOtherService.DoSomething(0);

mockLogger.Verify(l => l.LogError(It.IsAny<Exception>(), It.IsAny<string>(), 0));

}

With this we conclude.

Keep coding!

If you want to enhance yourself in Dot Net and improve yourself through Dot NET training program; our institute, CRB Tech Solutions would be of great help and support. We offer a well-structured program for the best Dot Net Course.

Stay connected to CRB Tech for your technical up-gradation and to remain updated with all the happenings in the world of Dot Net.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

Ways To Configure log4net For .NET Core

We start with the mention that the log4net team published new NuGet packages which support.NETStandard 1.3, which says it must work with .NET Core. This article is to discuss updates for log4net support.

Ways To Configure log4net For Dot NET Core

To start with: Configure() log4net

To add a reference to the log4net NuGet package is no problem. If you worked previously with log4net for any amount of time, you know that you must add codes for configuring it.

XmlConfigurator.Configure() needs some parameters that we didn’t usually provide in the past.

Configuration Workaround: Load It Manually

This log4net is good enough to load its configuration from a web.config or log4net.config file. In .NET Core, it doesn’t appear to know how.

It makes sense that this can’t read from a web.config/app.config because they don’t exist in .NET Core.

But, it doesn’t automatically try to read a log4net.config file. To mention, NLog does the same thing. You need to configure manually as in .NET Core.

With little little reverse dtudying, you will know how to load the log4net.config file and configure log4net.

var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

XmlConfigurator.Configure(logRepository, new FileInfo(“log4net.config”));

You can get this to work with a .NET Core app targeting both netcoreapp1.0 and net452. Sum up that to your Program.cs as the first thing your code does.

There is a mention about some limitations with the current 2.0.7 version of log4net. Hopefully, there will be some more developments.

Now with this, we conclude. We hope this was of help to you.

If you want to enhance yourself in Dot Net Course and improve yourself then our institute, CRB Tech Solutions would be of great help and support.

They offer a well-structured program for the best Dot Net Training course. Among many reputed institutes of dot net training and placement in Pune. Keep coding!!

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

Tips To Increase Visual Studio Editor Window Space Rapidly

Today under the topic for dot net coding tips and tricks, we shall discuss how to maximise the Visual Studio window space faster.

Tips To Increase Visual Studio Editor Window Space Rapidly

 

Many of you must like to prefer that, right? To bestow more screen space in Visual Studio to the editor window as possible.

At times doing the same on full-screen mode might not be that easy or your requirement, because getting to several tool windows — Solution Explorer, for example — isn’t certain.

Here we share Dot Net tips to bring back the tool panes to the windows layout, after hiding them by one click.

If you want to get the maximum space for your editor’s window without giving up the VS window, then go to Windows menu and select the option, Auto Hide All. That choice will collapse all of your tool panes: Solution Explorer, the Properties List, the toolbox, and all the related things will collapse into the sides of the Visual Studio, providing you a maximum editing space inside the Visual Studio.

You can definitely bring back the tool panes when you need them by a single click, but there is no “auto un-hide all” option; so you have to bring back every tool pane, individually.

In Visual Studio 2015, there was an alternative to bring back each tool page one-by-one. To make use of this, you need to first set up your “preferred” layout of tool panes. Next, assign this Windows layout a name and save it by visiting the Window menu and by selecting Save Window Layout.

With your preferred, saved the layout, after applying Auto Hide All; you can go back to the tool panes of your choice by selecting Window | Apply Window Layout | <your layout name> from the menu drop down list.

To mention, the earlier versions of Visual Studio did not have any option to save Windows layouts but only kept in memory, the layouts for 4 fixed modes: Design, Debug, Full Screen, and File.

Now with this, we conclude our today’s blog under dot net tips and tricks. We hope this was of help to you.

Keep coding!!

To be successful in yours .Net career, try to enhance your skill set in Dot Net Course and improve yourself through Dot NET training programs. In this reference our institute i.e. CRB Tech Solutions Pune could be of great help and support for you.

Stay connected to this space for more technical blogs and updates related to the world of Dot Net.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

Why You Need To Add An Error Handler To Your ASP.NET MVC Controller

Today we shall discuss error handling under the topic of dot net tips and tricks.

Need_To_Add_An_Error_Handler_To_Your_ASP_DOT_NET_MVC_Controller

An error handler is significant in order to avoid future problems. There isn’t anything like an “unhandled error” — if your code causes an error outside of a Try…Catch block, then the error will come up through several ASP.NET and .NET Framework error handlers. An “unhandled error” is actually another form of an error that you couldn’t handle.

Here we share Dot Net tips to avoid an error from bubbling up in future.

In ASP.NET MVC you could handle lots of errors by inserting an error handler inside your Controller: You need to add a OnException method to your Controller. The code will be implored each time there is an “unhandled error” in the Controller.

It’s an easy way to add the method: In your Controller, you need to type Overrides (in Visual Basic) or override (in C#), next press the Tab key to get a list of override methods, pick OnException from the drop down list, and again press the Tab key. Visual Studio will write the structure of the method for you.

The version for Visual Basic will as shown below:

Protected Overrides Sub OnException(filter context As ExceptionContext)

End Sub

Your method then sends an ExceptionContext object whose Exception property will give you access to all of the information telling what went wrong. Within the OnException method, you can do anything you want about the error which appears specific to the Controller. If you don’t take any further action, the error will keep coming up to the ASP.NET error handler.

And if you are willing to finish by making use of RedirectToRouteResult method built into the Controller to send the user an error page of your choice then you must stop that process, by which the error pops out. You can do with this line:

filter context.ExceptionHandled = True

This sets the ExceptionContext object’s ExceptionHandled property to True.

Now with this, we conclude. We hope this was of help to you. Keep looking into this space for more blogs on dot net coding tips and tricks.

Keep coding!! 

To be successful in yours .Net career, try to enhance your skill set and improve yourself through Dot NET training programs. In this reference, CRB Tech Solutions, Pune could be of great help and support for you.

Stay connected to this space for more technical blogs and updates related to the world of Dot Net.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

Final Features Of .NET Standard 2.0

The .NET Standard is a specification of the entire API’s that a .NET platform needs to implement in order to form a .NET platform. The standard is an open source, and you can find every different version and API’s in the same place.

Final Features Of .NET Standard 2.0

Now the .NET Standard 2.0 is with its final look. Microsoft has announced this and said that users can create .NET Standard 2.0 libraries and NuGet packages as well, but the company has suggested making use of .NET Core Preview 2 as it has several necessary enhancements to make your experience better.

Extra ordinary features of .NET Standard 2.0 as suggested by Microsoft:

Bigger API Surface

With doubled set of available APIs from 13k in .NET Standard 1.6 to 32k in version 2.0. will make it easier to port current codes to .NET Standard, and also to any .NET implementation of .NET Standard, like .NET Core 2.0 and the next version of UWP.

.NET Framework mode of compatibility

Majority of NuGet packages targets .NET Framework. Many projects are being blocked at present from moving to .NET Standard because all their dependencies are not targeting .NET Standard. Hence the need of compatibility mode that permits .NET Standard projects to depend on libraries of .NET Framework as if they were made for .NET Standard. It has been found that about 70% of NuGet packages on nuget.org are API compatible with .NET Standard 2.0, hence practically, it unblocks several projects.

Broad platform support

This will be supported on the below mentioned platforms:

.NET Framework 4.6.1

.NET Core 2.0

Mono 5.4

Xamarin.iOS 10.14

Xamarin.Mac 3.8

Xamarin.Android 7.5

Besides this, the company also told about the prerequisite tools for using .NET Standard 2.0. You need the latest versions of the following tools :

.NET Core SDK : Microsoft recommended to install .NET Core 2.0 Preview 2. This includes CLI as well.

Visual Studio: Users For this, you have to install Visual Studio 2017 15.3 which is the latest version of VS. For Mac users, the latest version of Visual Studio for Mac is perfect.

For more details, you can visit Microsoft site or read their release documents.

Now with this, we conclude. We hope this was of help to you.

Keep coding!! If you want to enhance yourself in Dot Net Course and improve yourself through Dot NET training program; our institute would be of great help and support. We offer well structured program for the Best Dot Net Training Course. Among many reputed institutes of dot net training and placement in Pune, CRB Tech has created a niche for itself.

Stay connected with us for your technical up-gradation and to remain updated with all the happenings in the world of Dot Net.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

3 Aspects Every ASP.Net Developers Must Know

With several options to design web applications in MS ecosystem like ASP.Net MVC, ASP.Net Web Forms, Single Page Applications. From the start of ASP.Net it supported ASP.Net Web Forms and even today enterprises develop many of web applications using them. The web forms help you create faster web applications.

3 Aspects Every ASP.Net Developers Must Know

But it envelops the underlying technology i.e. HTTP totally.

If you know the basics, you must know how to summon javascript from your code behind codes in ASP.Net Code.

In this article, we covered 3 basic things which every ASP.Net developer must know while using ASP.Net Web Forms

1.The nature of HTTP and Request-Response pattern:

All web applications are created using ASP.Net use HTTP protocol or its secured versions. You can consider HTTPS as using HHTP safely. HTTPS makes use of Secure Socket Layer (SSL) and encrypts your data. But, HTTPS still use HTTP.

HTTP is a no state protocol which follows a response/request pattern i.e., the user requests a resource and the web server sends the resource.

The web server never keeps any state of the previous requests. If the user requests for the same resource, the web server will respond as if the request was made for the first time. There are several ways to maintain the state in a web application. ViewState is one such way. Here all the data is coded in a hidden field and sent to the client and hence the state can be maintained between requests.

There are several other ways available to maintain the state which would be discussed later. For the time being, it is for your information that even though HTTP is stateless, there are certain options to maintain the state.

2. Role of CSS, HTML,Javascript, ASPX page in ASP.Net web application

Your browser can only understand HTML, CSS, javascript . So the web technology must be converted to technology based code to HTML, CSS and JS.

HTML provides the layout of the web page.

CSS or Cascading style sheet will help you in putting styles to elements on the page.

Javascript is to process the elements at client side without hitting the server. Javascript is used only for validation, to handle the user input, to change the style of some element based on data or user input etc…

When a user reaches out for the ASP.Net web page, these are the sequence of events that occur:

User reaches out the web page

The request is sent to the server where the web application is hosted. The web server carries forward the request to ASP.Net because the requested resource is of aspx page.

Net converts ASP.Net code into CSS, HTML and JS

The changed document is sent back to the user and the user gets the web page via the browser.

3. Differences between client side and server side

The ASP.Net server controls are changed into HTML elements at server side and the changed HTML parts are sent to the browser. To mention, javascript works only on HTML parts, and you must know the HTML element of ASP.Net server control that you are making use of to have the attributes changed.

Now we conclude. Keep coding!!

If you want to enhance yourself in Dot Net Course and improve yourself through Dot NET training program; our institute CRB Tech Solutions would be of great help and support. We offer well structured program for the Best Dot Net Training course.

Stay connected to with us for your technical up-gradation and to remain updated with all the happenings in the world of .Net.

Continue reading

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

The Use Of Validation Groups Inside ASP.NET User Controls

What does Validation groups do? Well, they permit you to validate data entry controls in the groups. Server controls like validation controls, Button and TextBox have ValidationGroup attributes that have a string value.

The Use Of Validation Groups Inside ASP.NET User Controls

All the server controls which have the same ValidationGroup value acts as a single validation group. Validation groups are necessary when you want to analyze only a small set of controls from several controls housed on a Web Form. Using validation groups is very easy and straight. But if you have a validation group inside a user control and there are many control instances on a Web Form you come across some problems.

To understand in details let’s develop a simple user control.

The Web Form has two instances of a user control – TestUC.ascx. The user control has a TextBox, a RequiredFieldValidator and a Button. The codes of the user control is shared below:

<asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox>

<asp:RequiredFieldValidator ID=”RequiredFieldValidator1″ runat=”server”

ControlToValidate=”TextBox1″ ErrorMessage=”*” Font-Bold=”True”

Font-Size=”30px” ForeColor=”Red”>*</asp:RequiredFieldValidator>

<asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click” Text=”Submit” />

<br />

<br />

<asp:Label ID=”Label1″ runat=”server” Font-Bold=”True” ForeColor=”Red”></asp:Label>

The Web Form has two instances of TestUC.ascx as mentioned below:

<%@ Page Language=”C#” … %>

<%@ Register Src=”~/TestUC.ascx” TagPrefix=”uc1″ TagName=”TestUC” %>

<!DOCTYPE html>

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head runat=”server”>

<title></title>

</head>

<body>

<form id=”form1″ runat=”server”>

<uc1:TestUC runat=”server” id=”TestUC1″ />

<br />

<uc1:TestUC runat=”server” id=”TestUC2″ />

</form>

</body>

</html>

If you put the ValidationGroup property of TextBox1, RequiredFieldValidator1 and Button1 to some string (e.g. VG) and then carry out the Web Form you will find that once getting clicked either of the Submit buttons, both the RequiredFieldValidatior controls display an error.

This behavior though not expected but occurs as both the instances of the user control using same ValidationGroup value.

To remove this problem you can take two approaches:

Provide a different and unique ValidationGroup value to the user control from the Web Form

Produce a unique value for ValidationGroup inside the user control

The first solution needs creation of a property (e.g. ValidationGroup) in user control. This attribute will accept a unique string value for the ValidationGroup and will assign to all the other necessary server controls. This is how the property can be developed:

public string ValidationGroup

{

get

{

return Button1.ValidationGroup;

}

set

{

Button1.ValidationGroup = value;

TextBox1.ValidationGroup = value;

RequiredFieldValidator1.ValidationGroup = value;

}

}

As shown, the set block of ValidationGroup attribute assign the given value to the ValidationGroup of Button1, TextBox1 and RequiredFieldValidator1.Once the ValidationGroup property is developed you can set it from the Web Form as given below:

<form id=”form1″ runat=”server”>

<uc1:TestUC runat=”server” id=”TestUC1″ ValidationGroup=”Group1″ />

<br />

<uc1:TestUC runat=”server” id=”TestUC2″ ValidationGroup=”Group2″ />

</form>

The ValidationGroup property of TestUC1 and TestUC2 is set to different and unique values. Now each user controls will work as per expectations.

In the next approach mentioned above you can auto-generate ValidationGroup value within the user control itself. The following code tells you how:

protected void Page_Load(object sender, EventArgs e)

{

if(!IsPostBack)

{

string vgId = Guid.NewGuid().ToString();

Button1.ValidationGroup = vgId;

TextBox1.ValidationGroup = vgId;

RequiredFieldValidator1.ValidationGroup = vgId;

}

}

The above code reveals the Page_Load event handler of the user control. The Page_Load event handler develops a new Guid using Guid.NewGuid() method. Next it sets ValidationGroup property of Button1, TextBox1 and RequiredFieldValidaror1 to this Guid string. Thus, every example of user control gets a unique ValidationGroup value and the Web Form woks as expected.

That’s it for now! Keep coding!!

If you want to enhance yourself in Dot Net Course and improve yourself through Dot NET training program; our institute would be of great help and support. We offer well structured program for the Best Dot Net Course

Stay connected to CRB Tech for your technical up-gradation and to remain updated with all the happenings in the world of Dot Net.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr

9 Things To Remember When You Develop A New ASP.NET Web Forms Application

Many developers desire or prefer ASP.NET MVC for their new web applications. But this might not be always possible and you might use Web Forms for your next projects. In such situations developers have a doubt about difficulties during a switch from Web Forms to MVC. If certain guidelines are followed while developing a Web Forms project later migrating to MVC would be hassle free.

9 Things To Remember When You Develop A New ASP.NET Web Forms Application

Here we listed top 9 recommendations in dealing with the similar situation:

1. Take Advantage Of Class Libraries Wherever Possible

Class Libraries are best for writing codes which are independent of any specific type of UI, because they contain mainly POCOs. If you isolate codes in class libraries then reuse during and after migration, it would be quite direct. Of course, you have to design these class libraries in an ordered manner rather than dumping them.

2. Avoid server control level UI properties

One common mistake by beginners is to set UI properties of the server controls. For instance, BackColor, ForeColor, Font-Name and so on. These properties are transformed into style features of the respective control tag. The best approach is to place all such styling information in CSS style sheets and then make use of ClassName property of the server controls to add a CSS class.

3. Use Web API

Web API was presented along with MVC but now it has become a part of ASP.NET framework and you can utilize Web API in Web Forms applications also.

4. Avoid specific features of Web Forms

Web Forms use several features which are specific to Web Forms. These features are not present in MVC. Attributes like Themes and Web Parts fall in this category. Don’t use these attributes for new projects because this will become difficult to migrate them to MVC projects owing to lack of equivalent sets of features.

5. Design forms to avoid ViewState

Many Web Forms developers develop their pages for data entry such that multiple tasks happen on a single page. This might need page ViewState enabled resulting in bulky forms. You must see if such tasks could be done separately into their own pages and try to avoid ViewState totally.

6. Create reusable UI through User Controls

Developers of Web Forms have two choices for creating reusable user interfaces: Web User Controls and Custom Server Controls. If you design Custom Server controls you provide a rich design interface but this control is not easily reusable in MVC.

7. Use standard HTML over server controls

Rich server controls are the best strength of Web Forms applications. Controls like GridView and ListView are very popular. While using the controls ensure the migration path difficulties because there is no straight equivalent in MVC. Though you can’t avoid using them totally try minimizing their use whenever possible.

8. Keep in mind MVC even for Web Forms applications

Web Forms are not designed with MVC design pattern in mind, but you can think in MVC terms as well. The separation of concern (SoC) as put by MVC can be done in Web Forms as well.

9. Learn and make use of Design Patterns and SOLID principles

Make an effort to learn SOLID design principles and commonly used Design Patterns such that you can make your Web Forms applications in a good way.

That’s for now! Keep coding!!

If you want to enhance yourself in Dot Net Course and improve yourself through Dot NET training program; our institute CRB Tech Solutions would be of great help and support.

Stay connected for getting technical up-gradation and to remain updated with all the happenings in the world of .Net.

Don't be shellfish...Buffer this pageEmail this to someoneDigg thisShare on FacebookShare on Google+Share on LinkedInPrint this pageShare on RedditPin on PinterestShare on StumbleUponTweet about this on TwitterShare on Tumblr