View web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Demo2.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 012c593c-2f2e-4375-904c-b834a06ea8a1-->
View csproj.xml
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
View CompletedCode.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using Microsoft.Practices.Unity;
View FetchingBindings.cs
//Method to Apply Endpoint behaviors
private static void ApplyEndPointBehaviors(object factory)
{
((ChannelFactory)factory).Endpoint.Behaviors.Add(new PortalContextHeaderClientBehavior());
((ChannelFactory)factory).Endpoint.Behaviors.Add(new CorpFaultBehavior());
}
//Method to collect all EndPoint addresses
private static List<Uri> ApplyAddressCollection(out List<string> contractCollection, out object address,
out ClientSection clientSection)
View CreateGenericFactory.cs
private static object CreateGenericFactory(Type t)
{
Type factoryType = typeof(ChannelFactory<>);
factoryType = factoryType.MakeGenericType(t);
//Call the Binding section to get the associtaed binding
var section = GetBindingsSection();
Binding binding = null;
View RegisterTypes.cs
public static void RegisterTypes(IUnityContainer container)
{
// NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements.
//container.LoadConfiguration();
// TODO: Register your types here
CreateFactory(container);
}
View RegisterTypes.cs
public static void RegisterTypes(IUnityContainer container)
{
// NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements.
//container.LoadConfiguration();
// TODO: Register your types here
/*Working Piece inline*/
container.RegisterType<IMovieServiceAsync>(
View btnInvoke_Click.cs
private void btnInvoke_Click(object sender, RoutedEventArgs e)
{
EndpointAddress address = new EndpointAddress("net.tcp://localhost:8011/MovieName");
Binding binding = new NetTcpBinding();
ChannelFactory<IMovieName> factory = new ChannelFactory<IMovieName>(binding, address);
IMovieName proxy = factory.CreateChannel();
View MainWindow.cs
using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Windows;
using MovieLib.Client.Contracts;
using MovieLib.Contracts;
using MovieLib.Proxies;
namespace MovieLib.Client
View generics.cs
using System;
namespace Generic_Constraints
{
class MyClassOne
{
public MyClassOne()
{
Console.WriteLine("Printing Ctor 1");
}