Skip to content

Commit

Permalink
Feature/create readme for nugets (#291)
Browse files Browse the repository at this point in the history
* Add readme and update .csproj files

* Code comment updates

* Fix warnings

* Remove obsolete SD Geo Ip nuget

* Fix warnings

* Update documentation

* Update build props and docs

* Update and remove irrelevant tests
  • Loading branch information
k3ldar authored Jun 16, 2024
1 parent c1e51d9 commit 58e271d
Show file tree
Hide file tree
Showing 187 changed files with 3,054 additions and 594 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ csharp_style_prefer_local_over_anonymous_function = true:error
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion

# S1168: Empty arrays and collections should be returned instead of null
dotnet_diagnostic.S1168.severity = none

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
Expand Down
6 changes: 0 additions & 6 deletions AspNetCore.PluginManager.Solution.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeoIpPlugin", "Plugins\GeoI
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SystemAdmin.Plugin", "Plugins\SystemAdmin.Plugin\SystemAdmin.Plugin.csproj", "{BCD38860-C640-4012-B148-FCEFF568FB23}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SieraDeltaGeoIpPlugin", "Plugins\SDGeoIpPlugin\SieraDeltaGeoIpPlugin.csproj", "{7D05CB90-EA96-4CE9-A15D-11828DD68F9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BadEgg.Plugin", "Plugins\BadEgg.Plugin\BadEgg.Plugin.csproj", "{5959741F-4BEA-45FD-ACBE-0B088A1AA50E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ErrorManager.Plugin", "Plugins\ErrorManager.Plugin\ErrorManager.Plugin.csproj", "{F401ED7C-DB39-49C1-87C0-813887343D84}"
Expand Down Expand Up @@ -167,10 +165,6 @@ Global
{BCD38860-C640-4012-B148-FCEFF568FB23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCD38860-C640-4012-B148-FCEFF568FB23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCD38860-C640-4012-B148-FCEFF568FB23}.Release|Any CPU.Build.0 = Release|Any CPU
{7D05CB90-EA96-4CE9-A15D-11828DD68F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D05CB90-EA96-4CE9-A15D-11828DD68F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D05CB90-EA96-4CE9-A15D-11828DD68F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D05CB90-EA96-4CE9-A15D-11828DD68F9D}.Release|Any CPU.Build.0 = Release|Any CPU
{5959741F-4BEA-45FD-ACBE-0B088A1AA50E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5959741F-4BEA-45FD-ACBE-0B088A1AA50E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5959741F-4BEA-45FD-ACBE-0B088A1AA50E}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
1 change: 1 addition & 0 deletions DAL/PluginManager.DAL.TextFiles/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Major Code Smell", "S6561:Avoid using \"DateTime.Now\" for benchmarking or timing operations", Justification = "Required for this context", Scope = "member", Target = "~M:PluginManager.DAL.TextFiles.Providers.BlogProvider.AddComment(Middleware.Blog.BlogItem@,Middleware.Blog.BlogComment@,System.Int64@,System.String@,System.String@)")]
[assembly: SuppressMessage("Critical Code Smell", "S2696:Instance members should not write to \"static\" fields", Justification = "<Pending>", Scope = "member", Target = "~M:PluginManager.DAL.TextFiles.Providers.DynamicContentProvider.Templates~System.Collections.Generic.List{SharedPluginFeatures.DynamicContent.DynamicContentTemplate}")]
5 changes: 5 additions & 0 deletions DAL/PluginManager.DAL.TextFiles/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This package is one of many packages that can be used with [Plugin Manager](https://www.nuget.org/packages/PluginManager) which can be used to extend any c#/.net based application (MVC, Winform, WPF, MAUI etc) by using a [Modular Approach](https://pluginmanager.website/docs/Document/A-Modular-Approach/).

# DAL TextFiles

This plugin module is the DAL for [SimpleDb](https://www.nuget.org/packages/SimpleDB)
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public ForeignKeyAttribute(string tableName)
{
}

/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of table the foreign key is linked to</param>
/// <param name="allowDefault">Allows default value of type if foreign key does not exist</param>
public ForeignKeyAttribute(string tableName, ForeignKeyAttributes foreignKeyAttributes)
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of table the foreign key is linked to</param>
/// <param name="foreignKeyAttributes">Foreign key attributes</param>
public ForeignKeyAttribute(string tableName, ForeignKeyAttributes foreignKeyAttributes)
: this(tableName, "Id", foreignKeyAttributes)
{
}
Expand Down
72 changes: 68 additions & 4 deletions Database/PluginManager.SimpleDB/Attributes/TableAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@

namespace SimpleDB
{
/// <summary>
/// Defines a tables property
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public class TableAttribute : Attribute
{
private const int MinimumSlidingTimeoutMilliseconds = 1;
private int _SlidingMemoryTimeoutMilliseconds;

/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of table</param>
/// <param name="compression">Type of compression to use for table</param>
/// <param name="cachingStrategy">Caching strategy in use for the table</param>
/// <param name="writeStrategy">Write strategy</param>
public TableAttribute(string tableName,
CompressionType compression = CompressionType.None,
CachingStrategy cachingStrategy = CachingStrategy.None,
Expand All @@ -41,15 +51,26 @@ public TableAttribute(string tableName,

}

public TableAttribute(string tableName,
/// <summary>
///
/// </summary>
/// <param name="tableName">Name of table</param>
/// <param name="writeStrategy">Write strategy</param>
public TableAttribute(string tableName,
WriteStrategy writeStrategy)
: this(String.Empty, tableName, CompressionType.None,
writeStrategy == WriteStrategy.Lazy ? CachingStrategy.Memory : CachingStrategy.None, writeStrategy)
{

}

public TableAttribute(string domain,
/// <summary>
/// Constructor
/// </summary>
/// <param name="domain"></param>
/// <param name="tableName">Name of table</param>
/// <param name="writeStrategy">Write strategy</param>
public TableAttribute(string domain,
string tableName,
WriteStrategy writeStrategy)
: this(domain, tableName, CompressionType.None,
Expand All @@ -58,6 +79,16 @@ public TableAttribute(string domain,

}

/// <summary>
///
/// </summary>
/// <param name="domain">Domain name for table</param>
/// <param name="tableName">Name of table</param>
/// <param name="compression">Type of compression to use for table</param>
/// <param name="cachingStrategy">Caching strategy in use for the table</param>
/// <param name="writeStrategy">Write strategy, default forced write</param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
public TableAttribute(string domain,
string tableName,
CompressionType compression = CompressionType.None,
Expand Down Expand Up @@ -89,18 +120,47 @@ public TableAttribute(string domain,
WriteStrategy = writeStrategy;
}

/// <summary>
/// Name of domain where table is located
/// </summary>
/// <value>string</value>
public string Domain { get; }

public string TableName { get; }
/// <summary>
/// Name of table
/// </summary>
/// <value>string</value>
public string TableName { get; }

public CompressionType Compression { get; }
/// <summary>
/// Type of compression to use, if any
/// </summary>
/// <value>CompressionType</value>

public CompressionType Compression { get; }

/// <summary>
/// Caching strategy for table data
/// </summary>
/// <value>CachingStrategy</value>
public CachingStrategy CachingStrategy { get; }

/// <summary>
/// Write strategy to use when saving data
/// </summary>
/// <value>WriteStrategy</value>
public WriteStrategy WriteStrategy { get; }

/// <summary>
/// Page size, not currently used
/// </summary>
/// <value>PageSize</value>
public PageSize PageSize { get; set; } = PageSize.Size8192;

/// <summary>
/// Sliding time out in ms, determines when the data is no longer required for data held in memory
/// </summary>
/// <value>int</value>
public int SlidingMemoryTimeoutMilliseconds
{
get
Expand All @@ -120,6 +180,10 @@ public int SlidingMemoryTimeoutMilliseconds
}
}

/// <summary>
/// Sliding memory timeout
/// </summary>
/// <value>TimeSpan</value>
public TimeSpan SlidingMemoryTimeout
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@

namespace SimpleDB
{
/// <summary>
/// Attribute indicating the value/property is unique within the table
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public class UniqueIndexAttribute : Attribute
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="name">Name of index</param>
/// <param name="indexType">Type of index</param>
/// <exception cref="ArgumentNullException"></exception>
public UniqueIndexAttribute(string name, IndexType indexType = IndexType.Ascending)
: this (indexType)
{
Expand All @@ -38,13 +47,25 @@ public UniqueIndexAttribute(string name, IndexType indexType = IndexType.Ascendi
Name = name;
}

public UniqueIndexAttribute(IndexType indexType = IndexType.Ascending)
/// <summary>
/// Constructor uses property name as index name
/// </summary>
/// <param name="indexType">Type of index</param>
public UniqueIndexAttribute(IndexType indexType = IndexType.Ascending)
{
IndexType = indexType;
}

/// <summary>
/// Type of index
/// </summary>
/// <value>IndexType</value>
public IndexType IndexType { get; }

/// <summary>
/// Name of index
/// </summary>
/// <value>string</value>
public string Name { get; }
}
}
4 changes: 4 additions & 0 deletions Database/PluginManager.SimpleDB/Delegates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@

namespace SimpleDB
{
/// <summary>
/// Database event delegate
/// </summary>
/// <param name="sender"></param>
public delegate void SimpleDbEvent(ISimpleDBTable sender);
}
24 changes: 24 additions & 0 deletions Database/PluginManager.SimpleDB/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,44 @@ public enum IndexType : byte
[Flags]
public enum TriggerType : byte
{
/// <summary>
/// No supported triggers
/// </summary>
None = 0,

/// <summary>
/// Before insert trigger supported
/// </summary>
BeforeInsert = 1,

/// <summary>
/// After insert trigger supported
/// </summary>
AfterInsert = 2,

/// <summary>
/// Before delete trigger supported
/// </summary>
BeforeDelete = 4,

/// <summary>
/// After delete trigger supported
/// </summary>
AfterDelete = 8,

/// <summary>
/// Before update trigger supported
/// </summary>
BeforeUpdate = 16,

/// <summary>
/// Before update comparing old record with new record trigger is supported
/// </summary>
BeforeUpdateCompare = 32,

/// <summary>
/// After update trigger supported
/// </summary>
AfterUpdate = 64,
}

Expand Down
10 changes: 10 additions & 0 deletions Database/PluginManager.SimpleDB/Exceptions/ForeignKeyException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,25 @@

namespace SimpleDB
{
/// <summary>
/// Foreign key exception class
/// </summary>
[Serializable]
public sealed class ForeignKeyException : Exception
{
/// <summary>
/// Constructor
/// </summary>
public ForeignKeyException()
: base()
{

}

/// <summary>
/// Constructor
/// </summary>
/// <param name="message">Exception message</param>
public ForeignKeyException(string message)
: base(message)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,19 @@

namespace SimpleDB
{
/// <summary>
/// Invalid data row exception which is raised when data is invalid
/// </summary>
[Serializable]
public sealed class InvalidDataRowException : Exception
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="dataRow">Data row name</param>
/// <param name="property">Property/column which violates the rule</param>
/// <param name="message">Exception message</param>
/// <exception cref="ArgumentNullException"></exception>
public InvalidDataRowException(string dataRow, string property, string message)
: base($"{message}; Table: {dataRow}; Property {property}")
{
Expand All @@ -46,10 +56,19 @@ public InvalidDataRowException(string dataRow, string property, string message)
OriginalMessage = message;
}

/// <summary>
/// Data row
/// </summary>
public string DataRow { get; }

/// <summary>
/// Property/column name
/// </summary>
public string Property { get; }

/// <summary>
/// Original error message
/// </summary>
public string OriginalMessage { get; }
}
}
15 changes: 15 additions & 0 deletions Database/PluginManager.SimpleDB/Exceptions/UniqueIndexException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,33 @@

namespace SimpleDB
{
/// <summary>
/// Exception raised when a record with a unique index is inserted twice
/// </summary>
[Serializable]
public class UniqueIndexException : Exception
{
/// <summary>
/// Default constructor
/// </summary>
public UniqueIndexException()
{
}

/// <summary>
/// Constructor
/// </summary>
/// <param name="message">Message description</param>
public UniqueIndexException(string message)
: base(message)
{
}

/// <summary>
/// Constructor
/// </summary>
/// <param name="message">Message description</param>
/// <param name="innerException">Inner Exception</param>
public UniqueIndexException(string message, Exception innerException)
: base(message, innerException)
{
Expand Down
Loading

0 comments on commit 58e271d

Please sign in to comment.