Skip to content

Commit

Permalink
Merge pull request #504 from arvindd/fsharp_worker_style
Browse files Browse the repository at this point in the history
Fsharp worker style
  • Loading branch information
karb0f0s authored Nov 5, 2023
2 parents fe4e49e + 69cf93d commit 7f28dea
Show file tree
Hide file tree
Showing 14 changed files with 536 additions and 277 deletions.
33 changes: 33 additions & 0 deletions FSharp.Examples.Polling/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# http://EditorConfig.org

# This file is the top-most EditorConfig file
root = true

# All Files
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

# Solution Files
[*.sln]
indent_style = tab

# XML Project Files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Configuration Files
[*.{json,xml,yml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
indent_size = 2

[*.cs]
# RCS1090: Call 'ConfigureAwait(false)'.
dotnet_diagnostic.RCS1090.severity = none

[*.md]
trim_trailing_whitespace = false
indent_size = 2
10 changes: 0 additions & 10 deletions FSharp.Examples.Polling/Configuration.fs

This file was deleted.

22 changes: 22 additions & 0 deletions FSharp.Examples.Polling/Extensions.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Extension functions needed to extract bot configuration
//
// Copyright (c) 2023 Arvind Devarajan
// Licensed to you under the MIT License.
// See the LICENSE file in the project root for more information.

namespace Microsoft.Extensions.DependencyInjection

open System
open Microsoft.Extensions.Options
open System.Runtime.CompilerServices

[<Extension>]
type PollingExtensions() =
[<Extension>]
static member GetConfiguration<'T when 'T: not struct>(sp: IServiceProvider) =
let o = sp.GetService<IOptions<'T>>()

if isNull o then
raise <| ArgumentNullException nameof<'T>

o.Value
46 changes: 24 additions & 22 deletions FSharp.Examples.Polling/FSharp.Examples.Polling.fsproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<WarnOn>3390;$(WarnOn)</WarnOn>
</PropertyGroup>

<ItemGroup>
<None Include="Files\tux.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration.fs" />
<Compile Include="Program.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Telegram.Bot" Version="19.0.0" />
<PackageReference Update="FSharp.Core" Version="6.0.7" />
</ItemGroup>

<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Util.fs" />
<Compile Include="Services\Internal\IReceiverService.fs" />
<Compile Include="Services\Internal\UpdateHandlerFuncs.fs" />
<Compile Include="Services\UpdateHandler.fs" />
<Compile Include="Services\ReceiverService.fs" />
<Compile Include="Services\PollingService.fs" />
<Compile Include="Extensions.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<None Include="Files\tux.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Telegram.Bot" Version="19.0.0" />
</ItemGroup>
</Project>
Loading

0 comments on commit 7f28dea

Please sign in to comment.