Skip to content
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/changelogs
LICENSE
README.md
!**/.gitignore
Expand Down
31 changes: 31 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# GitHub Copilot Instructions

Welcome to the `csla-mcp` repository! To ensure Copilot provides relevant and high-quality suggestions, please follow these guidelines:

## Coding Style
- Use consistent indentation (4 spaces).
- Prefer explicit variable names.
- Follow C# conventions for naming and structure.

## Documentation
- Add XML comments to public classes and methods.
- Use summary tags for method descriptions.

## Best Practices
- Write clean, maintainable code.
- Avoid hardcoding values; use configuration where possible.
- Implement error handling and logging.

## Pull Requests
- Ensure code is tested before submitting.
- Include a clear description of changes.

## Copilot Usage
- Use Copilot to generate boilerplate, tests, and documentation.
- Review and edit Copilot suggestions for accuracy and security.

## Change logs and change documents
- Create all change logs and change documents in the `changelogs` folder.
- When documenting fixes or other changes, put the documents in the `changelogs` folder.

Thank you for contributing!
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from `dotnet new gitignore`

changelogs/

# dotenv files
.env

Expand Down
159 changes: 0 additions & 159 deletions SEMANTIC_SEARCH_README.md

This file was deleted.

39 changes: 39 additions & 0 deletions csla-examples/v10/Command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Command Stereotype

This example demonstrates a complete CSLA business class named `CustomerExists` that includes various property types and data access methods. The class derives from `CommandBase<T>` and includes properties for input parameters and output results.

This class demonstrates the command business class stereotype.

It also includes a data portal operation method for executing the command. Note that the data access method contains a placeholder comment where actual data access logic should be invoked.

```csharp
using System;
using Csla;

[CslaImplementProperties]
public partial class CustomerExists : CommandBase<CustomerExists>
{
public partial bool Exists { get; set; }

[Execute]
private async Task Execute(string email, [Inject] ICustomerDal dal)
{
// Placeholder for actual data access logic
var customer = await dal.GetByEmailAsync(email);
Exists = customer != null;
}
}
```

> **Note:** The `ICustomerDal` interface is assumed to be defined elsewhere in your codebase and is responsible for data access operations related to customers. The `GetByEmailAsync` method is a placeholder for the actual implementation that retrieves a customer by their email address.

This class can be used to check if a customer with a specific email address exists in the data store by setting the `Email` property and then calling the data portal to execute the command. The result will be available in the `Exists` property.

To execute this command, you would typically do something like the following:

```csharp
var command = await customerExistsPortal.ExecuteAsync("[email protected]");
bool customerExists = command.Exists;
```

This assumes `customerExistsPortal` is a service of type `IDataPortal<CustomerExists>`.
32 changes: 32 additions & 0 deletions csla-examples/v10/CslaClassLibrary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CSLA .NET Class Library

Most CSLA .NET applications use a class library project to hold the business classes. This project typically references the CSLA .NET framework and any other necessary libraries.

```xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>14</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Csla" Version="10.0.0" />
<PackageReference Include="Csla.Generator.AutoImplementProperties.CSharp" Version="10.0.0"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>
</ItemGroup>
</Project>
```

CSLA 10 supports `TargetFramework` of .NET Framework 4.8, net8.0, net9.0, and net10.0.

CSLA 10 supports nullable reference types in its API, so `Nullable` is enabled.

CSLA 10 uses features from C# version 14, so the `LangVersion` is set to 14 (or higher).

The `Csla` package is referenced to enable the use of CSLA .NET features such as the rules engine, data portal, and other capabilities.

The `AutoImplementProperties` code generator package is referenced to enable standard code generation for CSLA properties.
91 changes: 91 additions & 0 deletions csla-examples/v10/EditableChild.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Editable Child Stereotype

This example demonstrates a complete CSLA business class named `OrderItemEdit` that includes various property types, business rules, authorization rules, and data access methods. The class derives from `BusinessBase<T>` and includes both read-only and read-write properties.

This class demonstrates the editable child business class stereotype.

It also shows how to implement business rules for validation, including required fields and range constraints. Additionally, it includes object-level authorization rules to control access based on user roles.

It also includes data portal operation methods for creating, fetching, inserting, updating, and deleting order item records. Note that the data access methods contain placeholder comments where actual data access logic should be invoked.

```csharp
using System;
using System.ComponentModel.DataAnnotations;
using Csla;

[CslaImplementProperties]
public partial class OrderItemEdit : BusinessBase<OrderItemEdit>
{
public partial int Id { get; private set; }
[Required]
[StringLength(100)]
public partial string ProductName { get; set; }
[Range(1, 1000)]
public partial int Quantity { get; set; }
[Range(0.01, 10000.00)]
public partial decimal Price { get; set; }

protected override void AddBusinessRules()
{
base.AddBusinessRules();
// Add any custom business rules here if needed
}

protected override void AddAuthorizationRules()
{
base.AddAuthorizationRules();
// Example: Only users in the "Manager" role can edit the Price property
BusinessRules.AddRule(new Csla.Rules.CommonRules.IsInRole(PriceProperty, "Manager"));
}

[CreateChild]
private void CreateChild()
{
// Initialize default values here if needed
LoadProperty(QuantityProperty, 1);
LoadProperty(PriceProperty, 0.01);
}

[FetchChild]
private void FetchChild(OrderDetailData data)
{
// Load properties from data object
LoadProperty(IdProperty, data.Id);
LoadProperty(ProductNameProperty, data.ProductName);
LoadProperty(QuantityProperty, data.Quantity);
LoadProperty(PriceProperty, data.Price);
}

[InsertChild]
private void InsertChild([Inject] IOrderDetailDal dal)
{
var data = new OrderDetailData
{
ProductName = ReadProperty(ProductNameProperty),
Quantity = ReadProperty(QuantityProperty),
Price = ReadProperty(PriceProperty)
};
var newId = dal.Insert(data);
LoadProperty(IdProperty, newId);
}

[UpdateChild]
private void UpdateChild([Inject] IOrderDetailDal dal)
{
var data = new OrderDetailData
{
Id = ReadProperty(IdProperty),
ProductName = ReadProperty(ProductNameProperty),
Quantity = ReadProperty(QuantityProperty),
Price = ReadProperty(PriceProperty)
};
dal.Update(data);
}

[DeleteSelfChild]
private void DeleteSelfChild([Inject] IOrderDetailDal dal)
{
dal.Delete(ReadProperty(IdProperty));
}
}
```
Loading