| Should this method be [Remote]? | Only aggregate root entry points |
Must [Remote] methods be internal? | Yes - [Remote] public is error NF0105; [Remote] internal promotes to public on factory interface |
| Can I use private setters? | No - breaks serialization |
| Should interface methods have attributes? | No - interface IS the boundary; op attributes emit NF0106 |
Which [AuthorizeFactory] scopes apply on an interface factory? | Execute / Read only. CRUD scopes silently never fire. Use parameter matching on the auth class for per-method auth. See references/interface-factory.md. |
Do I need partial keyword? | Yes, always |
| Should child entities have [Remote]? | No - causes N+1 remote calls |
Should child entity methods be internal? | Yes - server-only, trimmable, invisible to client |
| Can [Execute] return void? | No, must return Task |
| Can [Execute] go on a class factory? | Yes, if public static and returns containing type |
| How do I handle a factory event on the server? | [FactoryEventHandler<T>] class with a static matching method — runs in the caller's scope (shared DbContext/transaction), sequentially, awaited |
| How do I handle a factory event on the client? | Implement IFactoryEventRelay and register it in DI — RemoteFactory invokes Relay(IReadOnlyList<FactoryEventBase>) once per [Remote] call |
Does [FactoryEventHandler<T>] need [Factory]? | No — separate generator pipeline |
| I want a handler that participates in the factory's DB transaction | Use [FactoryEventHandler<T>] + IFactoryEvents.Raise — shared scope, sequential, exceptions propagate and roll back |
| I want to fire-and-forget external IO (email, webhook, queue) inside a factory method | Call Task.Run + IServiceScopeFactory.CreateScope() directly. RemoteFactory does not own this — snapshot any ambient context (correlation ID, tenant) before the Task.Run body and re-assign inside the child scope. |
| How do I stop an event from relaying to the client? | Pass RaiseOptions.ServerOnly to IFactoryEvents.Raise |
| Where must factory events be raised? | Inside a factory method via [Service] IFactoryEvents |
| Where does business logic go? | In the entity, not the factory |
| Can multiple types share a generic base? | Yes — use CRTP constraint (where T : MyBase<T>), [Factory] on base |
| How do I reduce Blazor WASM bundle size? | Enable IL trimming (strongly recommended) |
| How do I defer loading of related data? | Use LazyLoad<T> with ILazyLoadFactory |
Can I use BCL Lazy<T>? | No — use LazyLoad<T> (has serialization support) |