# Documentation Index

## 📖 @algochad/prisma-core Documentation

Welcome to the complete documentation for @algochad/prisma-core - a powerful NestJS library that brings Entity Framework Core-like operations to Prisma ORM and GraphQL.

### 🚀 Getting Started

- **[Installation Guide](./installation.md)** - Set up the library in your project
- **[Quick Setup Guide](./quick-setup.md)** - Complete setup with examples
- **[Quick Start Patterns](./quick-start-patterns.md)** - Most commonly used Select & OrderBy patterns

### 📚 Core Concepts

- **[Usage Guide](./usage-guide.md)** - Basic query operations and patterns
- **[LINQ Operations](./linq-operations.md)** - Synchronous and asynchronous LINQ operations
- **[Universal Repository Pattern](./repository-pattern.md)** - Three ways to access models

### ⚡ Performance & Optimization

- **[Performance Benchmarks](./performance.md)** - Comprehensive benchmarking and optimization guide

### 📖 Reference

- **[API Reference](./api-reference.md)** - Complete API documentation
- **[Troubleshooting](./troubleshooting.md)** - Common issues and solutions
- **[Examples & Tutorials](./examples.md)** - Real-world examples and tutorials

### 🤝 Community

- **[Contributing](./contributing.md)** - How to contribute to the project
- **[License](./LICENSE.md)** - MIT License details

## 🌟 Features Overview

- **🏗️ EF-Core-like Operations**: Intuitive query building using Prisma ORM
- **🌐 GraphQL Data Source Support**: Full LINQ-style queries with GraphQL APIs
- **🔗 LINQ Operations**: Basic port of C# LINQ operations
- **🔧 Extensible API**: Unified, type-safe API for database and GraphQL interactions
- **⚡ Performance Optimized**: Built-in benchmarking and performance tools
- **🏢 NestJS Integration**: Native integration for NestJS applications
- **📊 Universal Repository Pattern**: Dynamic model access with full type safety
- **🔄 Transaction Support**: Comprehensive transaction management (Prisma ORM)

## 📊 Quick Reference

### Most Common Patterns

```typescript
// Basic query with Select and OrderBy
const results = await repository.test
    .Where({ isActive: true })
    .Select({ id: true, name: true, description: true })
    .OrderBy({ name: 'asc' })
    .ToArray();

// LINQ-style transformations
const transformed = await repository.test
    .Where({ isActive: true })
    .ToEnumerable()
    .Where((test) => test.description != null)
    .Select((test) => ({
        id: test.id,
        displayName: test.name.toUpperCase(),
        summary: `${test.name}: ${test.description}`,
    }))
    .OrderBy((item) => item.displayName)
    .ToArray();

// Async performance optimization
const optimized = await AsyncEnumerable.from(largeDataset)
    .Where(async (item) => await validateAsync(item))
    .Select(async (item) => await transformAsync(item))
    .ToArrayAsync();
```

### Repository Setup

```typescript
@Injectable()
export class AppRepository extends PrismaRepository {
    get user() {
        return this.model<User>('user') as any;
    }
    get post() {
        return this.model<Post>('post') as any;
    }
}
```

### Performance Guidelines

- Use **Enumerable** for simple operations on small datasets (< 1,000 items)
- Use **AsyncEnumerable** for complex operations and large datasets (> 1,000 items)
- Use **AsQueryable()** for database-level operations with Prisma query syntax
- Use **ToEnumerable()** for LINQ-style in-memory transformations

## 🔗 External Links

- **📦 NPM Package**: [@algochad/prisma-core](https://www.npmjs.com/package/@algochad/prisma-core)
- **🐛 GitHub Issues**: [Report Issues](https://github.com/algochad/prisma-core/issues)
- **💬 GitHub Discussions**: [Community Discussions](https://github.com/algochad/prisma-core/discussions)
- **🏗️ Prisma Documentation**: [Prisma Docs](https://www.prisma.io/docs)
- **🏢 NestJS Documentation**: [NestJS Docs](https://docs.nestjs.com)
