All Projects → main76 → dotnetjs

main76 / dotnetjs

Licence: other
.Net Framework support in javascript/typescript.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to dotnetjs

lambda2js
Converts a C# expression tree (from Linq namespace) to a syntatically correct javascript code.
Stars: ✭ 51 (+325%)
Mutual labels:  linq
sanity-linq
Strongly-typed .Net Client for Sanity
Stars: ✭ 36 (+200%)
Mutual labels:  linq
try.elinq
Language Integrated Query (LINQ) technology for relational databases and EF Core
Stars: ✭ 21 (+75%)
Mutual labels:  linq
go-streams
Stream Collections for Go. Inspired in Java 8 Streams and .NET Linq
Stars: ✭ 127 (+958.33%)
Mutual labels:  linq
LinqToXsdCore
LinqToXsd ported to .NET Core (targets .NET Standard 2 for generated code and .NET Core 3.1, .NET 5+ 6 for the code generator CLI tool).
Stars: ✭ 23 (+91.67%)
Mutual labels:  linq
ksqlDB.RestApi.Client-DotNet
ksqlDb.RestApi.Client is a C# LINQ-enabled client API for issuing and consuming ksqlDB push queries and executing statements. SqlServer.Connector is a client API for consuming row-level table changes (CDC - Change Data Capture) from Sql Server databases with the Debezium connector streaming platform.
Stars: ✭ 44 (+266.67%)
Mutual labels:  linq
LinqSpecs
A toolset for use the specification pattern in LINQ queries.
Stars: ✭ 161 (+1241.67%)
Mutual labels:  linq
XPath2.Net
Lightweight XPath2 for .NET
Stars: ✭ 26 (+116.67%)
Mutual labels:  linq
SqlBatis
A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite etc..
Stars: ✭ 34 (+183.33%)
Mutual labels:  linq
linqr
Query Comprehensions for Ruby
Stars: ✭ 15 (+25%)
Mutual labels:  linq
linq
A familiar set of functions that operate on JavaScript iterables (ES2015+) in a similar way to .NET's LINQ does with enumerables.
Stars: ✭ 39 (+225%)
Mutual labels:  linq
dotnet-arangodb
.NET Driver for ArangoDB
Stars: ✭ 52 (+333.33%)
Mutual labels:  linq
linq-collections
Strongly typed Linq and Collections implementation for Javascript and TypeScript (ECMAScript 5)
Stars: ✭ 112 (+833.33%)
Mutual labels:  linq
Beetle.js
🪲 Javascript ORM, manage your data easily.
Stars: ✭ 53 (+341.67%)
Mutual labels:  linq
lib12
lib12 is a library of universal helpers and extensions useful in any .NET project
Stars: ✭ 30 (+150%)
Mutual labels:  linq
dotnet-learning
Материалы для обучения C# и ASP.NET
Stars: ✭ 62 (+416.67%)
Mutual labels:  linq
js-linq
$linq is a Javascript version of .NET's Linq to Objects, with some query operations inspired by MoreLinq (an extension to Linq to Objects).
Stars: ✭ 34 (+183.33%)
Mutual labels:  linq
BlazorDB
In memory, persisted to localstorage, database for .net Blazor browser framework
Stars: ✭ 74 (+516.67%)
Mutual labels:  linq
linqjs
use linq and lambda in javascript on es6, can use linq function in an Object or an Array or a String value | 一个方便对数组、字典、树形数据进行操作、筛选等操作的工具库
Stars: ✭ 17 (+41.67%)
Mutual labels:  linq
go2linq
Generic Go implementation of .NET's LINQ to Objects.
Stars: ✭ 41 (+241.67%)
Mutual labels:  linq

DotnetJs

.Net Framework support in javascript

Get DotnetJs

  1. Nodejs

    firstly, run npm install dotnetjs --save

    If you are using typescript:

    import * as DotnetJs from 'dotnetjs';

    else just like the others:

    var DotnetJs = require('dotnetjs');
  2. Browser

    run npm install dotnetjs --save

    or download the files in the dist directory.

    or run bower install dotnetjs

    <!--if debug-->
    <script src="dotnet.js"></script>
    <!--if release-->
    <script src="dotnet.min.js"></script>
    <script src="your.js"></script>

    in your .ts file:

    /// <reference path="dotnet.d.ts" />

Work with DotnetJs

DotnetJs uses similiar interface as it is in .Net Framework.

Linq

If you are about to use complicated Linq Expressions, first make a instance of LinqIntermediate by using LinqStart:

var expression = DotnetJs.Linq.LinqStart(enumerable);

the enumerable can be any type that implements IEnumerable, in addition, I implemented it for the Array. Then you can do like the following:

expression.Where(...).Select(...).ToArray();

Or use:

DotnetJs.Linq.Where(enumerable, ...).Select(...).ToArray();

remember to use ToArray or ToList or ToDictionary to end the expression(if the result is still IEnumerable). No matter how long your linq is, the time complexity is always O(n).

String Format

The match case: {index[,alignment][:format]}, with 2 optional parameters (alignment and format).

  1. index

    Index indicate the index of the object in the following parameter args[].

  2. alignment

    Alignment will do PadLeft or PadRight with spaces, if it is positive then do PadLeft, else do PadRight.

  3. format

    With the magic char ':', you can control the format of your toString method. For number, there are specifiers ['D', 'E', 'F', 'G', 'N', 'P', 'X'] implemented, usage portal. Now, let's see the following example:

    var number = 1.0437E21;
    var specifier = 'G';
    console.writeLine("   {0,-22} {1:G}", specifier + ":", number);
    // output:   G:                     1.0437e+21
    
    class Foo {
        public bar: number;
        public toString(format: string) {
            if (format == null)
                return this.bar.toString();
            if (format == '!')
                return '!' + this.bar;
            return '?' + this.bar;
        }
    }
    
    var foo = new Foo();
    foo.bar = 65521;
    
    console.log(String.Format('test Foo toString: {0:!}, {0:?}, {0,10}', foo));
    // output: test Foo toString: !65521, ?65521,      65521

Indexer for the collections

As there isn't have a way to implement indexer in typescript. You have to call the element of List or IDictionay, by using GetValue(index || key) and SetValue(index || key, value), but not collection[index || key].

GetHashCode

Both object, string, boolean or number are supported for the GetHashCode Method, actually for the object, it is more likely to be called as a 'unique id'.

To get a new hashcode for an object, call the method with parameter 'ture'. But please becareful, this may due to unexpected errors (e.g.: when you are using Dictionary).

Equals

If you inherit from typescript abstract class ValueType, remember to override Equals method, else it will compare the result of GetHashCode() to decide whether it equals to the other.

ContainsKey

var obj = { name: 'readme' };

console.log(obj.ContainsKey('name'));
// output: true

TODO

More extensions. If you have any idea, please feel free to contact me.

Test

Change directory to tests, then run tsc to compile the typescript files, then run npm link ../ secondly, to set up the local dependence, finally run node index.js to start the test.

Contributors

Master76 Author

AsherWang RegExp suport

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].