Code Monkey home page Code Monkey logo

dotnet-app's Introduction

Follow @ServiceStack or view the docs, use StackOverflow or the Customer Forums for support.

View the Release Notes for latest features or see servicestack.net/features for an overview.

Simple, Fast, Versatile and full-featured Services Framework

ServiceStack is a simple, fast, versatile and highly-productive full-featured Web and Web Services Framework that's thoughtfully-architected to reduce artificial complexity and promote remote services best-practices with a message-based design that allows for maximum re-use that can leverage an integrated Service Gateway for the creation of loosely-coupled Modularized Service Architectures. ServiceStack Services are consumable via an array of built-in fast data formats (inc. JSON, XML, CSV, JSV, ProtoBuf, Wire and MsgPack) as well as XSD/WSDL for SOAP endpoints and Rabbit MQ, Redis MQ and Amazon SQS MQ hosts.

Its design and simplicity focus offers an unparalleled suite of productivity features that can be declaratively enabled without code, from creating fully queryable Web API's with just a single Typed Request DTO with Auto Query supporting every major RDBMS to the built-in support for Auto Batched Requests or effortlessly enabling rich HTTP Caching and Encrypted Messaging for all your existing services via Plugins.

Your same Services also serve as the Controller in ServiceStack's Smart Razor Views reducing the effort to serve both Web and Single Page Apps as well as Rich Desktop and Mobile Clients that are able to deliver instant interactive experiences using ServiceStack's real-time Server Events.

ServiceStack Services also maximize productivity for consumers providing an instant end-to-end typed API without code-gen enabling the most productive development experience for developing .NET to .NET Web Services.

ServiceStack now integrates with all Major IDE's used for creating the best native experiences on the most popular platforms to enable a highly productive dev workflow for consuming Web Services, making ServiceStack the ideal back-end choice for powering rich, native iPhone and iPad Apps on iOS with Swift, Mobile and Tablet Apps on the Android platform with Java, OSX Desktop Applications as well as targeting the most popular .NET PCL platforms including Xamarin.iOS, Xamarin.Android, Windows Store, WPF, WinForms and Silverlight:

Providing instant Native Typed API's for C#, TypeScript, F# and VB.NET directly in Visual Studio for the most popular .NET platforms including iOS and Android using Xamarin.iOS and Xamarin.Android on Windows.

Providing C# Native Types support for developing iOS and Android mobile Apps using Xamarin.iOS and Xamarin.Android with Xamarin Studio on OSX. The ServiceStackXS plugin also provides a rich web service development experience developing Client applications with Mono Develop on Linux

Providing an instant Native Typed API in Swift including generic Service Clients enabling a highly-productive workflow and effortless consumption of Web Services from native iOS and OSX Applications - directly from within Xcode!

Providing an instant Native Typed API in Java and Kotlin including idiomatic Java Generic Service Clients supporting Sync and Async Requests by leveraging Android's AsyncTasks to enable the creation of services-rich and responsive native Java or Kotlin Mobile Apps on the Android platform - directly from within Android Studio!

The ServiceStack IDEA plugin is installable directly from IntelliJ's Plugin repository and enables seamless integration with IntelliJ Java Maven projects for generating a Typed API to quickly and effortlessly consume remote ServiceStack Web Services from pure cross-platform Java or Kotlin Clients.

The unmatched productivity offered by Java Add ServiceStack Reference is also available in the ServiceStackEclipse IDE Plugin that's installable from the Eclipse MarketPlace to provide deep integration of Add ServiceStack Reference with Eclipse Java Maven Projects enabling Java Developers to effortlessly Add and Update the references of their evolving remote ServiceStack Web Services.

In addition to our growing list of supported IDE's, the servicestack-cli cross-platform command-line npm scripts makes it easy for build servers, automated tasks and command-line runners of your favorite text editors to easily Add and Update ServiceStack References!

Simple Customer Database REST Services Example

This example is also available as a stand-alone integration test:

//Web Service Host Configuration
public class AppHost : AppSelfHostBase
{
    public AppHost() 
        : base("Customer REST Example", typeof(CustomerService).Assembly) {}

    public override void Configure(Container container)
    {
        //Register which RDBMS provider to use
        container.Register<IDbConnectionFactory>(c => 
            new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider));

        using (var db = container.Resolve<IDbConnectionFactory>().Open())
        {
            //Create the Customer POCO table if it doesn't already exist
            db.CreateTableIfNotExists<Customer>();
        }
    }
}

//Web Service DTO's
[Route("/customers", "GET")]
public class GetCustomers : IReturn<GetCustomersResponse> {}

public class GetCustomersResponse
{
    public List<Customer> Results { get; set; } 
}

[Route("/customers/{Id}", "GET")]
public class GetCustomer : IReturn<Customer>
{
    public int Id { get; set; }
}

[Route("/customers", "POST")]
public class CreateCustomer : IReturn<Customer>
{
    public string Name { get; set; }
}

[Route("/customers/{Id}", "PUT")]
public class UpdateCustomer : IReturn<Customer>
{
    public int Id { get; set; }

    public string Name { get; set; }
}

[Route("/customers/{Id}", "DELETE")]
public class DeleteCustomer : IReturnVoid
{
    public int Id { get; set; }
}

// POCO DB Model
public class Customer
{
    [AutoIncrement]
    public int Id { get; set; }

    public string Name { get; set; }
}

//Web Services Implementation
public class CustomerService : Service
{
    public object Get(GetCustomers request)
    {
        return new GetCustomersResponse { Results = Db.Select<Customer>() };
    }

    public object Get(GetCustomer request)
    {
        return Db.SingleById<Customer>(request.Id);
    }

    public object Post(CreateCustomer request)
    {
        var customer = new Customer { Name = request.Name };
        Db.Save(customer);
        return customer;
    }

    public object Put(UpdateCustomer request)
    {
        var customer = Db.SingleById<Customer>(request.Id);
        if (customer == null)
            throw HttpError.NotFound("Customer '{0}' does not exist".Fmt(request.Id));

        customer.Name = request.Name;
        Db.Update(customer);

        return customer;
    }

    public void Delete(DeleteCustomer request)
    {
        Db.DeleteById<Customer>(request.Id);
    }
}

No code-gen required, can re-use above Server DTOs:

var client = new JsonServiceClient(BaseUri);

//GET /customers
var all = client.Get(new GetCustomers());                         // Count = 0

//POST /customers
var customer = client.Post(new CreateCustomer { Name = "Foo" });

//GET /customer/1
customer = client.Get(new GetCustomer { Id = customer.Id });      // Name = Foo

//GET /customers
all = client.Get(new GetCustomers());                             // Count = 1

//PUT /customers/1
customer = client.Put(
    new UpdateCustomer { Id = customer.Id, Name = "Bar" });       // Name = Bar

//DELETE /customers/1
client.Delete(new DeleteCustomer { Id = customer.Id });

//GET /customers
all = client.Get(new GetCustomers());                             // Count = 0

Same code also works with Android, iOS, Xamarin.Forms, UWP and WPF clients.

F# and VB.NET can re-use same .NET Service Clients and DTO's

const client = new JsonServiceClient(baseUrl);
const { results } = await client.get(new GetCustomers());
let client = JsonServiceClient(baseUrl: BaseUri)

client.getAsync(GetCustomers())
    .then {
        let results = $0.results;
    }
JsonServiceClient client = new JsonServiceClient(BaseUri);

GetCustomersResponse response = client.get(new GetCustomers());
List<Customer> results = response.results; 
val client = JsonServiceClient(BaseUri)

val response = client.get(GetCustomers())
val results = response.results
var client = new JsonServiceClient(BaseUri);

var response = await client.get(GetCustomers());
var results = client.results;
$.getJSON($.ss.createUrl("/customers", request), request, (r: GetCustomersResponse) => {
    var results = r.results;
});

Using TypeScript Definitions with Angular HTTP Client:

this.http.get<GetCustomersResponse>(createUrl('/customers', request)).subscribe(r => {
    this.results = r.results;
});

Calling from jQuery

$.getJSON(baseUri + "/customers", function(r) {
	var results = r.results;
});

That's all the application code required to create and consume a simple database-enabled REST Web Service!

Getting Started

Download

If you have NuGet installed, the easiest way to get started is to:

Latest v4+ on NuGet is a commercial release with free quotas.

The Definitive list of Example Projects, Use-Cases, Demos, Starter Templates

Copying

Since September 2013, ServiceStack source code is available under GNU Affero General Public License/FOSS License Exception, see license.txt in the source. Alternative commercial licensing is also available, see https://servicestack.net/pricing for details.

Contributing

Contributors need to approve the Contributor License Agreement before any code will be reviewed, see the Contributing docs for more details. All contributions must include tests verifying the desired behavior.

OSS Libraries used

ServiceStack includes source code of the great libraries below for some of its core functionality. Each library is released under its respective licence:

Find out More

Follow @ServiceStack and +ServiceStack for project updates.


Core Team

Contributors

A big thanks to GitHub and all of ServiceStack's contributors:


Similar open source projects

Similar Open source .NET projects for developing or accessing web services include:

  • Nancy Fx - A Sinatra-inspired lightweight Web Framework for .NET:
  • Fubu MVC - A "Front Controller" pattern-style MVC framework designed for use in web applications built on ASP.NET:
  • Rest Sharp - An open source REST client for .NET

dotnet-app's People

Contributors

dependabot[bot] avatar gistlyn avatar layoric avatar mythz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dotnet-app's Issues

app publish-exe does not work.

Hello, I've followed the instructions to install the dotnet CLI tool below:

λ  dotnet tool install -g app

Following the instructions here, the publish-exe command is not recognized. I'm not sure if I'm missing something, or if it's only available in a pre-release or available when built from source.

This is the output I receive when attempting to run that command:


Version:  5.1.1

Usage:

  app new                     List available Project Templates
  app new <template> <name>   Create New Project From Template
  app download <user>/<repo>  Download latest GitHub Repo Release
  app get <url>               Download remote file                     (-out <file|dir>)

  app <lang>                  Update all ServiceStack References in directory (recursive)
  app <file>                  Update existing ServiceStack Reference (e.g. dtos.cs)
  app <lang>     <url> <file> Add ServiceStack Reference and save to file name
  app csharp     <url>        Add C# ServiceStack Reference            (Alias 'cs')
  app typescript <url>        Add TypeScript ServiceStack Reference    (Alias 'ts')
  app swift      <url>        Add Swift ServiceStack Reference         (Alias 'sw')
  app java       <url>        Add Java ServiceStack Reference          (Alias 'ja')
  app kotlin     <url>        Add Kotlin ServiceStack Reference        (Alias 'kt')
  app dart       <url>        Add Dart ServiceStack Reference          (Alias 'da')
  app fsharp     <url>        Add F# ServiceStack Reference            (Alias 'fs')
  app vbnet      <url>        Add VB.NET ServiceStack Reference        (Alias 'vb')
  app tsd        <url>        Add TypeScript Definition ServiceStack Reference

  app proto <url>             Add gRPC .proto ServiceStack Reference
  app proto <url> <name>      Add gRPC .proto and save to <name>.services.proto
  app proto                   Update all gRPC *.services.proto ServiceStack References
  app proto-langs             Display list of gRPC supported languages
  app proto-<lang> <url>      Add gRPC .proto and generate language    (-out <dir>)
  app proto-<lang> <file|dir> Update gRPC .proto and re-gen language   (-out <dir>)
  app proto-<lang>            Update all gRPC .proto's and re-gen lang (-out <dir>)

  app mix                     Show available gists to mixin            (Alias '+')
  app mix <name>              Write gist files locally, e.g:           (Alias +init)
  app mix init                Create empty .NET Core ServiceStack App
  app mix #<tag>              Search available gists
  app mix <gist-url>          Write all Gist text files to current directory
  app gist <gist-id>          Write all Gist text files to current directory

  app alias                   Show all local gist aliases (for usage in mix or app's)
  app alias <alias>           Print local alias value
  app alias <alias> <gist-id> Set local alias with Gist Id or Gist URL
  app unalias <alias>         Remove local alias

  app run <name>.ss           Run #Script within context of AppHost   (or <name>.html)
  app watch <name>.ss         Watch #Script within context of AppHost (or <name>.html)
                              Language File Extensions:
                                   .ss - #Script source file
                                   .sc - #Script `code` source file
                                   .l  - #Script `lisp` source file
  app lisp                    Start Lisp REPL

  app open                    List of available Sharp Apps
  app open <app>              Install and run Sharp App

  app run                     Run Sharp App in current directory
  app run <name>              Run Installed Sharp App
  app run path/app.settings   Run Sharp App at directory containing specified app.settings
  app <name>.dll              Run external .NET Core App
  app <name>.exe              Run external self-contained .NET Core App

  app install                 List available Sharp Apps to install     (Alias 'l')
  app install <app>           Install Sharp App                        (Alias 'i')

  app uninstall               List Installed Sharp Apps
  app uninstall <app>         Uninstall Sharp App

  app publish                 Publish Current Directory to Gist (requires token)

  app gist-new <dir>          Create new Gist with Directory Files (requires token)
  app gist-update <id> <dir>  Update Gist ID with Directory Files  (requires token)

  app shortcut                Create Shortcut for Sharp App
  app shortcut <name>.dll     Create Shortcut for .NET Core App


  dotnet tool update -g app   Update to latest version

Options:
    -h, --help, ?             Print this message
    -v, --version             Print this version
    -d, --debug               Run in Debug mode for Development
    -r, --release             Run in Release mode for Production
    -s, --source              Change GitHub Source for App Directory
    -f, --force               Quiet mode, always approve, never prompt
        --token               Use GitHub Auth Token
        --clean               Delete downloaded caches
        --verbose             Display verbose logging
        --ignore-ssl-errors   Ignore SSL Errors

This tool collects anonymous usage to determine the most used commands to improve your experience.
To disable set SERVICESTACK_TELEMETRY_OPTOUT=1 environment variable to 1 using your favorite shell.

Here are installed dotnet CLI sdks and runtimes:

SDKs:

λ  dotnet --list-sdks
2.1.811 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.404 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]

Runtimes:

λ  dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

observerations attempting to build on mac

the team I work with is building dotnet 6 app - I'd like to use on mac.
when I run
docker build .

it fails

docker build .
[+] Building 0.6s (13/18)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 867B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for mcr.microsoft.com/dotnet/sdk:5.0 0.3s
=> [internal] load build context 0.0s
=> => transferring context: 25B 0.0s
=> CANCELED [build 1/8] FROM mcr.microsoft.com/dotnet/sdk:5.0@sha256:c5df98ac266e6cd2b94c3ac4e153d7e43db0a84b833b125 0.0s
=> => resolve mcr.microsoft.com/dotnet/sdk:5.0@sha256:c5df98ac266e6cd2b94c3ac4e153d7e43db0a84b833b125cada852ec16edd7 0.1s
=> => sha256:c5df98ac266e6cd2b94c3ac4e153d7e43db0a84b833b125cada852ec16edd752 2.17kB / 2.17kB 0.0s
=> => sha256:d8e8e2bc5e652402685754b72747bed99579aec4bfd5c6f13cb964bfa47ed2ae 2.01kB / 2.01kB 0.0s
=> => sha256:d90b87c477ea8f8b1196de55dd785d2fb504de6aec0bba3a1d60750d8db6f3d9 7.15kB / 7.15kB 0.0s
=> CACHED [build 2/8] WORKDIR /src 0.0s
=> ERROR [build 3/8] COPY /src/GistRun/GistRun.csproj ./ 0.0s
=> CACHED [build 4/8] RUN dotnet nuget add source https://www.myget.org/F/servicestack -n myget.org 0.0s
=> CACHED [build 5/8] RUN dotnet restore 0.0s
=> ERROR [build 6/8] COPY /src/GistRun . 0.0s
=> CACHED [build 7/8] RUN dotnet publish -c Release -o /app/publish --no-restore 0.0s
=> ERROR [build 8/8] COPY /src/GistRun/NuGet.Config /app/publish 0.0s
=> ERROR [final 2/7] COPY /src/GistRun/prefetch.sh ./ 0.0s

[build 3/8] COPY /src/GistRun/GistRun.csproj ./:



[build 6/8] COPY /src/GistRun .:



[build 8/8] COPY /src/GistRun/NuGet.Config /app/publish:



[final 2/7] COPY /src/GistRun/prefetch.sh ./:


failed to compute cache key: "/src/GistRun/GistRun.csproj" not found: not found

App Shortcut not working?

I can launch my app just fine using the command:
app MVCDemoApp.exe

What I am trying to do is create a desktop shortcut that the user can launch just by double-clicking it.
I think the command I want is:
app shortcut MVCDemoApp.exe

When I do this, all I get is the help listing for the app command. Am I doing this right? Is there any more documentation for the 'app shortcut' command?

Thanks,

Len.

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.