Repository: ekonbenefits/dynamitey
Branch: master
Commit: c44f5c57cb8a
Files: 73
Total size: 705.5 KB
Directory structure:
gitextract_b38rdefz/
├── .appveyor.yml
├── .github/
│ └── workflows/
│ ├── dotnet.yml
│ └── dotnet48.yml
├── .gitignore
├── .vscode/
│ └── tasks.json
├── Directory.Build.props
├── Dynamitey/
│ ├── Builder.cs
│ ├── CacheableInvocation.cs
│ ├── Dynamic.cs
│ ├── DynamicObjects/
│ │ ├── BaseDictionary.cs
│ │ ├── BaseForwarder.cs
│ │ ├── BaseObject.cs
│ │ ├── Builder.cs
│ │ ├── Dictionary.cs
│ │ ├── Dummy.cs
│ │ ├── ExtensionToInstanceProxy.cs
│ │ ├── Factory.cs
│ │ ├── FauxType.cs
│ │ ├── FluentStringLookup.cs
│ │ ├── Get.cs
│ │ ├── LateType.cs
│ │ ├── Lazy.cs
│ │ ├── LinqInstanceProxy.cs
│ │ ├── List.cs
│ │ ├── Mimic.cs
│ │ ├── Recorder.cs
│ │ └── RegexMatch.cs
│ ├── Dynamitey.csproj
│ ├── Expando.cs
│ ├── FluentRegex.cs
│ ├── InlineLambdas.cs
│ ├── InlineLambdas.tt
│ ├── Internal/
│ │ ├── Compat/
│ │ │ └── Net40.cs
│ │ ├── Curry.cs
│ │ ├── InvokeSetters.cs
│ │ └── Optimization/
│ │ ├── BareBonesList.cs
│ │ ├── BinderHash.cs
│ │ ├── InvokeHelper-Regular.cs
│ │ ├── InvokeHelper.cs
│ │ ├── InvokeHelper.tt
│ │ └── Util.cs
│ ├── Invocation.cs
│ ├── InvokeArg.cs
│ ├── InvokeContext.cs
│ ├── InvokeMemberName.cs
│ ├── PartialApply.cs
│ ├── ThisFunctions.cs
│ ├── ThisFunctions.tt
│ ├── Tupler.cs
│ └── sn.snk
├── Dynamitey.sln
├── Dynamitey.sln.DotSettings
├── License.txt
├── NuGet.config
├── Readme.md
├── SupportLibrary/
│ ├── SupportLibrary.csproj
│ └── SupportTypes.cs
├── TestResult.xml
├── Tests/
│ ├── Curry.cs
│ ├── DynamicObjects.cs
│ ├── ExpandoObjs.cs
│ ├── Helper.cs
│ ├── Impromptu.cs
│ ├── Invoke.cs
│ ├── Linq.cs
│ ├── MimicTest.cs
│ ├── PrivateTest.cs
│ ├── SpeedTest.cs
│ ├── Tests.csproj
│ ├── TimeIt.cs
│ └── TuplerTest.cs
├── Version.props
└── build.fsx
================================================
FILE CONTENTS
================================================
================================================
FILE: .appveyor.yml
================================================
image: Visual Studio 2017
configuration: Debug
build: off
install:
- ps: nuget install FSharp.Compiler.Tools -ExcludeVersion -OutputDirectory extra
build_script:
- cmd: set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\extra\FSharp.Compiler.Tools\tools\
- cmd: fsi --exec ./build.fsx
test: off
artifacts:
- path: '**\bin\*\*.nupkg'
skip_branch_with_pr: true
skip_tags: true
deploy:
- provider: NuGet
server: https://www.myget.org/F/dynamitey-ci/api/v2/package
api_key:
secure: yKbBrG0QiTfXUvND1/cMMNHxH1Bgal5g7c0pWGwqvjCtKGTtWkpvE2KlZb6E2ZgB
skip_symbols: false
symbol_server: https://www.myget.org/F/dynamitey-ci/symbols/api/v2/package
for:
- branches:
except:
- /v.*/
environment:
vsuffix: alpha$(APPVEYOR_BUILD_NUMBER)
is_prerelease: true
- branches:
only:
- /v.*-beta/
environment:
vsuffix: beta$(APPVEYOR_BUILD_NUMBER)
is_prerelease: true
- branches:
only:
- /v[\d,.]*/
configuration: Release
environment:
vsuffix: $(APPVEYOR_BUILD_NUMBER)
is_prerelease: false
================================================
FILE: .github/workflows/dotnet.yml
================================================
name: Build .net core
on: [push]
jobs:
build:
name: Test ${{ matrix.os }} for dotnet ${{ matrix.dotnet }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
dotnet: [ '8.0.x' ]
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Build with dotnet core
run: dotnet build --configuration Release
- name: Tests
run: dotnet test Tests/Tests.csproj --configuration Release --no-build --no-restore --filter=TestCategory!=Performance
================================================
FILE: .github/workflows/dotnet48.yml
================================================
name: Build CrossComple .net core/.net framework Windows
on: [push]
jobs:
build:
name: Test Windows .net Framework and Core
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: NuGet/setup-nuget@v2
- uses: microsoft/setup-msbuild@v2
with:
dotnet-version: 4.8
- name: Restore Packages
run: nuget restore Dynamitey.sln
- name: Build solution
run: msbuild Dynamitey.sln -t:rebuild -property:Configuration=Release
- name: Test
uses: josepho0918/vstest-action@0e887de8dcfab5ce3eecaf4ad6320bb9b3ecf633
with:
testAssembly: Tests.dll
searchFolder: .\Tests\bin\Release\*\
runInParallel: true
otherConsoleOptions: /TestCaseFilter:"(TestCategory!=Performance)"
platform: x64
- name: Publish
run:
dotnet nuget push '${{ github.workspace }}\publish\*.nupkg' --source https://nuget.pkg.github.com/ekonbenefits/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
f
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
/dist/*.nupkg
*.userprefs
.fake/*
.nuget/NuGet.exe
.idea/*
.vs/*
.ionide/*
================================================
FILE: .vscode/tasks.json
================================================
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "./build.fsx",
"args": ["Test"],
"windows":{
"command": "C:\\Program Files (x86)\\Microsoft SDKs\\F#\\4.1\\Framework\\v4.0\\fsi",
"args": ["--exec", "./build.fsx", "Test"]
},
"isShellCommand": true,
"showOutput": "always",
"problemMatcher":"$msCompile"
}
================================================
FILE: Directory.Build.props
================================================
True
================================================
FILE: Dynamitey/Builder.cs
================================================
//
// Copyright 2011 Ekon Benefits
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Linq;
using Dynamitey.DynamicObjects;
namespace Dynamitey
{
///
/// Builds Objects with a Fluent Syntax
///
public static class Builder
{
///
/// New Builder
///
///
public static IBuilder New()
{
return new Builder();
}
///
/// New Builder
///
/// The type of the object prototype.
///
public static IBuilder New() where TObjectPrototype : new()
{
return new Builder();
}
}
///
/// Syntax for a quick new inline prototype object
///
public static class Build
{
private static readonly dynamic _objectBuilder = new Builder().Object;
private static readonly dynamic _listBuilder =
Dynamic.Curry(new Builder().ListSetup()).
List();
///
/// Gets the new object builder.
///
/// The new object.
public static dynamic NewObject => _objectBuilder;
///
/// Gets the new list builder.
///
/// The new list.
public static dynamic NewList => _listBuilder;
}
///
/// Syntax for a quick inline object property setup
///
/// The type of the object prototype.
public static class Build where TObjectPrototype : new()
{
// ReSharper disable StaticFieldInGenericType
private static readonly dynamic _typedBuilder = new Builder().Object;
// ReSharper restore StaticFieldInGenericType
// ReSharper disable StaticFieldInGenericType
private static readonly dynamic _typedListBuilder = Dynamic.Curry(new Builder().ListSetup()).List();
// ReSharper restore StaticFieldInGenericType
///
/// Gets the new object builder.
///
/// The new.
public static dynamic NewObject => _typedBuilder;
///
/// Gets the new list builder.
///
/// The new list.
public static dynamic NewList => _typedListBuilder;
}
///
/// Encapsulates an Activator
///
public class Activate
{
///
/// Initializes a new instance of the class.
///
/// The type.
/// The args.
public Activate(Type type, params object[] args)
{
Type = type;
var tArg = args.OfType>().SingleOrDefault();
if (tArg != null)
Arguments = tArg;
else
Arguments = () => args;
}
///
/// Initializes a new instance of the class. With Factory Function
///
/// The type.
/// The args.
public Activate(Type type, Func