SenDev Analyzers
SenDev Analyzers is a collection of Roslyn analyzers and code fixes for DevExpress eXpress Application Framework (XAF)
Below, there is a list of analyzers with short descriptions
SetPropertyValue Analyzer
Ensures, that SetPropertyValue methods are used in property setters. When the base class has a SetPropertyValue method, analyzer emits a warning and provides a
code fix, when SetPropertyValue is not used in the setter or the property is auto-implemented.
Example:
private bool anotherProperty;
[Browsable(false)]
[ModelDefault(nameof(IModelMember.Caption), "Another Property")]
public bool AnotherProperty
{
get
{
return anotherProperty;
}
set
{
SetPropertyValue(nameof(AnotherProperty), ref anotherProperty, value);
}
}
XafClass Analyzer
Xaf class analyzer ensures, that every class implementing IXPSimpleObject
has following attributes:
- ImageName
- VisibleInReports
- XafDefaultProperty
- CreatableItem
- NavigationItem
- DefaultListViewOptions
- ModelDefault
Example:
[ImageName("BO_Unknown")]
[VisibleInReports(false)]
[XafDefaultProperty("<DefaultPropertyName>")]
[CreatableItem(false)]
[NavigationItem(false)]
[DefaultListViewOptions(false, NewItemRowPosition.None)]
[ModelDefault(nameof(IModelClass.Caption), "Class1")]
class Class1 : IXPSimpleObject
XafCommonProperty Analyzer
This analyzer ensures, that every public property has following attributes:
- VisibleInDetailView
- VisibleInListView
- VisibleInLookupListView
- ModelDefault
Example:
[VisibleInDetailView(false)]
[VisibleInListView(false)]
[VisibleInLookupListView(false)]
[ModelDefault(nameof(IModelMember.Caption), "Class Info")]
public XPClassInfo ClassInfo => throw new NotImplementedException();
XafDateTimeProperty Analyzer
This analyzer ensures, that DateTime
properties has formatting attributes declared:
Example:
private DateTime anotherDTProperty;
[ModelDefault(nameof(IModelMember.DisplayFormat), "{0:d}")]
[ModelDefault(nameof(IModelMember.EditMask), "d")]
public DateTime AnotherDTProperty
{
get
{
return anotherDTProperty;
}
set
{
SetPropertyValue(nameof(AnotherDTProperty), ref anotherDTProperty, value);
}
}
XafStringProperty Analyzer
This analyzer ensuers, that string
public properties hasSize
attribute declared.
Example:
private string AnotherStringAttribute;
[VisibleInDetailView(false)]
[VisibleInListView(false)]
[VisibleInLookupListView(false)]
[ModelDefault(nameof(IModelMember.Caption), "another String Attribute")]
[Size(SizeAttribute.DefaultStringMappingFieldSize)]
public string anotherStringAttribute
{
get
{
return AnotherStringAttribute;
}
set
{
SetPropertyValue(nameof(anotherStringAttribute), ref AnotherStringAttribute, value);
}
}
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.