Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fsharp worker style #504

Merged
merged 8 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading