Skip to content

Commit 5dc06f6

Browse files
Add README file
1 parent a11b13f commit 5dc06f6

File tree

2 files changed

+14
-151
lines changed

2 files changed

+14
-151
lines changed

Orleans.sln

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
4-
VisualStudioVersion = 17.12.35527.113 d17.12
4+
VisualStudioVersion = 17.12.35527.113
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nameless.Orleans.Client", "Nameless.Orleans.Client\Nameless.Orleans.Client.csproj", "{CBF03431-B3E9-4F48-B1EB-914D160930A3}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nameless.Orleans.Grains", "Nameless.Orleans.Grains\Nameless.Orleans.Grains.csproj", "{F13D80D5-290A-4976-8457-34B2904463B2}"
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nameless.Orleans.Silo", "Nameless.Orleans.Silo\Nameless.Orleans.Silo.csproj", "{DB20CA79-6551-4A1F-A475-A3D3EBCB748B}"
1111
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D5DFD0D7-A39F-4C3F-A05E-0D6C2E95EB79}"
13+
ProjectSection(SolutionItems) = preProject
14+
README.md = README.md
15+
EndProjectSection
16+
EndProject
1217
Global
1318
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1419
Debug|Any CPU = Debug|Any CPU

README.md

+8-150
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,31 @@
1-
# Nameless
1+
# Sample ATM App with Microsoft Orleans
22

3-
This repository contains all code that I assume is useful in most of the cases
4-
where I need to build something. So, if you think that it could be useful for
5-
you, feel free to fork, clone, etc. Also, I tried to mention every person that
6-
I got something from. If you find code that needs to be given the correct
7-
authorship, please, let me know.
3+
This repository contains code for a simple (really) ATM application that uses
4+
Microsoft Orleans to demonstrate the Actor Pattern.
85

96
## Starting
107

118
Instructions below will show your the way to get things working.
129

1310
### Pre-requirements
1411

15-
You'll need to install, at least, .NET Core SDK and Visual Studio Code.
16-
Just follow the links:
12+
If you have a Microsoft Azure subscription you can use it or if you more like
13+
me, a broke-ass developer, you can run Azurite on Docker and get it going:
1714

18-
- [.NET Core SDK](https://dotnet.microsoft.com/en-us/download/dotnet)
19-
- [Visual Studio Code](https://code.visualstudio.com/download)
20-
21-
## Development
22-
23-
Here are a couple of apps that I find useful when developing:
24-
25-
- [LINQPad](https://www.linqpad.net/download.aspx): For writing LINQ-Queries or
26-
use as a REPL.
27-
- [Notepad++](https://notepad-plus-plus.org/downloads/): You know what this is,
28-
don't you?
29-
- [SQLite Browser](https://sqlitebrowser.org/dl/): One of the best data browsers
30-
for SQLite databases.
31-
- [Git](https://git-scm.com/downloads): No need (I hope) for presentations.
32-
- [ILSpy](https://github.com/icsharpcode/ILSpy/releases): When you want to take
33-
a peek on the compiled code that no one have the source.
34-
- [SMTP4Dev](https://github.com/rnwood/smtp4dev/releases): Small SMTP server
35-
that runs as a service on your machine, for send e-mail tests. Very useful.
36-
- [DBeaver](https://dbeaver.io/download/): An alternative for databases
37-
management. Don't have all options for each specific database, but, Oh-boy,
38-
it's useful.
39-
- [Postman](https://www.postman.com/downloads/): Useful to test Rest API calls.
40-
Similar to SoapUI, but I think that it's much more easy to handle.
41-
- [Sonarlint](https://www.sonarsource.com/products/sonarlint/): Analyze and
42-
suggest code modifications on-the-fly. Has a free-tier.
43-
44-
These are all just suggestions.
45-
46-
47-
## Testing
48-
49-
Maybe you'll need to install the coverage tool and report tool. If I'm not
50-
mistaken, Visual Studio already has those dependencies installed for you after
51-
restore. But...
52-
53-
_.NET Coverlet Tool_
54-
55-
```
56-
dotnet tool install -g coverlet.console
57-
```
58-
59-
_.NET Report Generator Tool_
60-
61-
```
62-
dotnet tool install -g dotnet-reportgenerator-globaltool
63-
```
64-
65-
### Skipping Tests
66-
67-
Some tests will need a software to run or any other resource that may not be available on your
68-
build environment. For example, ProducerConsumer for RabbitMQ project needs RabbitMQ to run.
69-
70-
For these tests to run on my GitHub Actions (workflow) I needed a way to "mute" them and run only
71-
locally, since I could setup, again, RabbitMQ on a Docker container on my machine.
72-
73-
So, if you need to "mute" a test and run it only locally, use the **RunsOnDevMachineAttribute** attribute
74-
on your test method.
75-
76-
### Creating Code Coverage Report
77-
78-
When you feel comfortable, you should run all tests and output the coverage
79-
result to a folder. The Report Generator Tool will take from there. So, do as
80-
follow:
81-
82-
Run tests with:
83-
```
84-
dotnet test --logger:"Html;LogFileName=code-coverage-log.html" --collect:"XPlat Code Coverage" --results-directory ./code-coverage/ --verbosity normal
85-
```
86-
87-
Run the report tool with:
88-
```
89-
reportgenerator "-reports:./code-coverage/**/coverage.cobertura.xml" "-targetdir:./code-coverage/report" -reporttypes:Html
15+
```powershell
16+
docker run -name azurite -d -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
9017
```
91-
92-
If you want to know more about the report tool, see their [FAQ](https://reportgenerator.io/usage).
18+
You can get more information from Microsoft at [Use the Azurite emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cblob-storage)
9319

9420
## Coding Styles
9521

9622
Nothing written into stone, use your ol'good common sense. But you can refere
9723
to this page, if you like: [Common C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions).
9824

99-
### Some Ideas to Keep in Mind
100-
101-
- When I create a new extension method I never check for nullability of the
102-
target instance. If the target instance is **_null_**, you'll get
103-
an **_NullReferenceException_** on your face, punk!
104-
- **_default_** vs **_null_** :
105-
- Am I sure is a reference type? **null**
106-
- Am I sure is a value type? **default**
107-
- I'm not sure at all: **default**
108-
- I think that most of my developer's life I spent writing C# code. But I like
109-
that kind of code organization from Java. So, I use, almost, the same code
110-
style identation on my projects.
111-
- Methods that returns arrays, collections or enumerables in general,
112-
**DO NOT RETURN _NULL_ VALUE EVER!!!** If there's no value to return, just
113-
return an empty enumerable from the same type. Use [_Array.Empty\<T\>()_](https://learn.microsoft.com/en-us/dotnet/api/system.array.empty?view=net-7.0) or
114-
[_Enumerable.Empty\<T\>()_](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.empty?view=net-7.0),
115-
or I'll cut the tips of your fingers with a rust scissor...thanks.
116-
- If you're returning an **_IEnumerable\<T\>_**, probably you should use the
117-
**_yield_** keywork on your method return directive.
118-
119-
### Dependency Injection "Battle"
120-
121-
Let us not talk about [Unity](https://learn.microsoft.com/en-us/previous-versions/msp-n-p/ff647202(v=pandp.10)?redirectedfrom=MSDN)
122-
or [MEF](https://learn.microsoft.com/en-us/dotnet/framework/mef/). These were from
123-
a really long time ago, on a far-far away galaxy...(I think that MEF is still in use
124-
inside some modern projects from Microsoft).
125-
126-
Look, I, really, understand that [Microsoft](https://www.microsoft.com/pt-br/)
127-
has its own modern dependency injection system ([ServiceCollection](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.servicecollection) extensions).
128-
It'll work for most of all simple cases and applications. But for more complex
129-
scenarios, some that I cross paths on my developer's life, it'll not be the best.
130-
131-
Don't get me wrong, it's simple, fast, reliable and easy to use. And should be
132-
your first choice if you're starting a new ASP.NET Core project.
133-
134-
But I'll advocate for [Autofac](https://autofac.readthedocs.io/en/latest/index.html).
135-
It has way more road beneath its codebase and has some amazing features. Like
136-
[Decorators](https://autofac.readthedocs.io/en/latest/advanced/adapters-decorators.html) and
137-
[Type Interceptors](https://autofac.readthedocs.io/en/latest/advanced/interceptors.html).
138-
So, that said, all projects inside this repository will favor Autofac. 🤘😜
139-
140-
## Deployment
141-
142-
I'm using GitHub Actions to act as a CI/CD. All files are located in the
143-
.github folder.
144-
145-
## Template
146-
147-
There is a small "microservice" template inside the template folder. To
148-
install it just use:
149-
150-
```
151-
dotnet new install <FULL_PATH_TO_MICROSERVICE_FOLDER>
152-
```
153-
154-
E.g:
155-
156-
```
157-
dotnet new install C:\Workspace\Nameless\template\Microservice\Nameless.Microservice
158-
```
159-
160-
After that you can create a new project, using **dotnet new** or
161-
**Visual Studio / New Project** and search for **_Microservice_** template.
162-
16325
## Contribuition
16426

16527
Just me, at the moment.
16628

167-
## Versioning
168-
169-
Using [SemVer](http://semver.org/) for assembly versioning.
170-
17129
## Authors
17230

17331
- **Marco Teixeira (marcoaoteixeira)** - _initial work_

0 commit comments

Comments
 (0)