Coder Social home page Coder Social logo

patrickhitch / impromptu-interface Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ekonbenefits/impromptu-interface

0.0 2.0 0.0 2.45 MB

Static interface to dynamic implementation (duck casting). That and more using the DLR.

License: Apache License 2.0

F# 1.14% C# 92.59% Visual Basic 6.25% Batchfile 0.02%

impromptu-interface's Introduction

C# 4.0 (.net & silverlight) framework to allow you to wrap any object (static or dynamic) with a static interface even though it didn't inherit from it. It does this by emitting cached dynamic binding code inside a proxy. By expanding on the DLR plumbing used to implement this library, it has grown to support more general dynamic implementations.

See Wiki for full examples of all features. Other features include Really Late Binding, Inline Syntaxes, Currying, some dynamic extensions for FSharp, and unsealed Dynamic Objects including a fully dynamic MVVM ViewModel

###Roadmap:

  • 6.5
  • 7.0
    • Strip out Obsolete Code
    • Full PCL port of Interface Wrapping
    • Tool to pregenerate proxies for WinRT

###Quick Usage:

    using ImpromptuInterface;
    using ImpromptuInterface.Dynamic;

    public interface IMyInterface{

       string Prop1 { get;  }

        long Prop2 { get; }

        Guid Prop3 { get; }

        bool Meth1(int x);
   }
   //Anonymous Class
    var anon = new {
             Prop1 = "Test",
             Prop2 = 42L,
             Prop3 = Guid.NewGuid(),
             Meth1 = Return<bool>.Arguments<int>(it => it > 5)
    }

    var myInterface = anon.ActLike<IMyInterface>();

##OR##

   //Dynamic Expando object
    dynamic expando = Build<ExpandoObject>.NewObject(
             Prop1: "Test",
             Prop2: 42L,
             Prop3: Guid.NewGuid(),
             Meth1: Return<bool>.Arguments<int>(it => it > 5)
    );

    IMyInterface myInterface = Impromptu.ActLike(expando);

##ALSO##

    //In F#
    let expando:obj = !?Build<ExpandoObject>.NewObject (
    			dynArg("Test")         ? Prop1,
				dynArg(42L)            ? Prop2,
				dynArg(Guid.NewGuid()) ? Prop3,
				dynArg(Return<bool>.Arguments<int>(fun x -> x > 5))
                                                       ? Meth1
		        )

    let myInterface = expando.ActLike<IMyInterface>()

###Get The Code### Project can be checked out from git repository, works with .net 4.0, Silverlight 4.0 & 5.0 and mono 2.10

###Get The Binaries### use NuGet Visual Studio Extension "Add Libary Package Refrence... from Visual Studio or download the zip file. Source Code for debugging the binaries can be provided automatically from SymbolSource.org

###Get The Samples### There is a Sample mercurial repository for code samples. Currently it has an ImpromptuInterface.MVVM based calculator implemented in WPF or Silverlight or F#. sample repository.

impromptu-interface's People

Contributors

jbtule avatar fearthecowboy avatar hmemcpy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.