Skip to content
Merged
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
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Provides code-level tools for Umbraco
# Provides code-level tools for Umbraco

#### MapAll
## Tools

### MapAll

Helps replacing AutoMapper with static code, without missing properties. Adding the Umbraco.Code NuGet package to a project adds a Roslyn code analyzer and fix.

Expand Down Expand Up @@ -34,15 +36,15 @@ public void Map(SomeType source, OtherType target)
{}
~~~~

#### Volatile
### Volatile

Allows for classes, methods, members, interfaces, enums and attributes to be marked as volatile with an attribute. Reources marked with volatile, or from a class marked as volatile,
Allows for classes, methods, members, interfaces, enums and attributes to be marked as volatile with an attribute. Resources marked with volatile, or from a class marked as volatile,
will throw an error and fail to compile. The error can be suppressed to a warning with the assembly level attribute UmbracoSuppressVolatileAttribute.

This is intented to be used for resources that were previously marked as internal, typically because the may break in the future,
but are still useful in some aspect, typically testing where it doesn't matter if a method breaks.
This is intended to be used for resources that were previously marked as internal, typically because the may break in the future,
but are still useful in some aspect, typically testing where it doesn't matter if a method breaks.

Marking a method as volatile looks like this:
Marking a method as volatile looks like this:
~~~c#
public class DemoClass
{
Expand All @@ -55,8 +57,8 @@ Marking a method as volatile looks like this:
}
~~~

Whenever ```DemoClass.VolatileMethod``` is invoked there'll be raised an UmbracoCodeVolatile error,
to suppress it to a warning use the assembly level UmbracoSuppressVolatileAttribute:
Whenever ```DemoClass.VolatileMethod``` is invoked there'll be raised an UmbracoCodeVolatile error,
to suppress it to a warning use the assembly level UmbracoSuppressVolatileAttribute:
~~~c#
[assembly: UmbracoSuppressVolatile]
namespace VolatileDemo
Expand Down Expand Up @@ -84,7 +86,7 @@ namespace VolatileDemo

Now there'll only be raised a warning even though ```DemoClass.VolatileMethod``` is marked as volatile.

The same thing goes for objects, if you do something like this:
The same thing goes for objects, if you do something like this:
~~~c#
[UmbracoVolatile]
public class DemoClass
Expand All @@ -97,18 +99,23 @@ The same thing goes for objects, if you do something like this:
}
~~~

All of DemoClasses methods and members will be marked as volatile.
All of DemoClasses methods and members will be marked as volatile.

For more examples see the unit tests.

##### The Attributes
It's worthwile noting that the attributes are compared by name and not by type.
#### The Attributes
It's worthwhile noting that the attributes are compared by name and not by type.

This means that it's not needed to use the attributes that are included in this project (the namespace of analyzers is not accessible),
any attribute named UmbracoVolatileAttribute or UmbracoSuppressVolatileAttribute will do the trick.

## Deployment

This means that it's not needed to use the attributes that are included in this project (the namespace of analyzers is not accecible),
any attribute named UmbracoVolatileAttribute or UmbracoSuppressVolatileAttribute will do the trick.
To prepare a release artifact, build the solution in release mode and a NuGet package will be created in `Umbraco.Code\bin\Release`.

This can be published to NuGet.org or a private NuGet feed.

#### Sources and References
## Sources and References

Inspired by, and probably stealing code from:

Expand Down