Skip to content

Commit

Permalink
Merge pull request #53 from mhelvacikoylu/merge_test
Browse files Browse the repository at this point in the history
clear playground
  • Loading branch information
hizliemre authored Feb 28, 2020
2 parents d9c39e3 + 4546dc2 commit 2d1e52a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 95 deletions.
81 changes: 2 additions & 79 deletions src/Samples/Playground/Program.cs
Original file line number Diff line number Diff line change
@@ -1,90 +1,13 @@
using System;
using System.Reflection;
using System.Threading.Tasks;
using Twino.Ioc;
using System.Threading.Tasks;

namespace Playground
{

interface IService1
{
void Test1();
}

interface IService2
{
void Test2();
}

class Service1 : IService1
{

public void Test1()
{
Console.WriteLine("echo 1");
}
}

class Service2 : IService2
{
public void Test2()
{ }
}

interface IService3 { }
class Service3 : IService3
{
public Service3(IService1 service1)
{
service1.Test1();
}
}

class Service1Proxy : IServiceProxy
{
private IService2 _service2;
public Service1Proxy(IService2 service2)
{
_service2 = service2;
}

public object Proxy(object decorated)
{
return DenemeDispatchProxy<IService1>.Create((IService1)decorated, _service2);
}
}


class DenemeDispatchProxy<T> : DispatchProxy
{
private T _decorated;
private IService2 _service2;
public static T Create(T decorated, IService2 service2)
{
object proxy = Create<T, DenemeDispatchProxy<T>>();
DenemeDispatchProxy<T> instance = (DenemeDispatchProxy<T>)proxy;
instance._decorated = decorated;
instance._service2 = service2;
return (T)proxy;
}

protected override object Invoke(MethodInfo targetMethod, object[] args)
{
Console.WriteLine("PROXY");
return targetMethod.Invoke(_decorated, args);
}
}

class Program
{
static async Task Main(string[] args)
{
var container = new ServiceContainer();
container.AddSingleton<IService1, Service1, Service1Proxy>();
container.AddSingleton<IService2, Service2>();
container.AddSingleton<IService3, Service3>();
var instance3 = await container.Get<IService3>(container.CreateScope());
Console.ReadLine();

}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -13,11 +14,11 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Mehmet Helvacıköylü")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Twino Core library for all twino servers, protocols and services")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.Core")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.Core")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -13,11 +14,11 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Mehmet Helvacıköylü")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("HttpClient Factory extension for Twino IOC")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.Extensions.Http")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.Extensions.Http")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -13,11 +14,11 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Mehmet Helvacıköylü")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Twino IOC Service containers and scopes")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.Ioc")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.Ioc")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -13,11 +14,11 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Mehmet Helvacıköylü")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Messaging Queue Server library with TMQ Protocol via Twino Server")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.MQ")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.MQ")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -13,11 +14,11 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Mehmet Helvacıköylü")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("JSON Web Token Authentication and Authorization library for Twino MVC")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.Mvc.Auth.Jwt")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.Mvc.Auth.Jwt")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -13,11 +14,11 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Mehmet Helvacıköylü")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Twino Http Protocol library and server extension for Twino Server")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.Protocols.Http")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.Protocols.Http")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -13,11 +14,11 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Mehmet Helvacıköylü")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("WebSocket Protocol library and server extension for Twino Server")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.Protocols.WebSocket")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.Protocols.WebSocket")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -14,11 +15,11 @@
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyDescriptionAttribute("Twino Serializable Model library for object based communication with text-based p" +
"rotocols")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.12")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Twino.SerializableModel")]
[assembly: System.Reflection.AssemblyTitleAttribute("Twino.SerializableModel")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.10")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.12")]

// Generated by the MSBuild WriteCodeFragment class.

0 comments on commit 2d1e52a

Please sign in to comment.