asynkron / protoactor-dotnet-contrib

Contributions for ProtoActor .NET
http://proto.actor
Apache License 2.0
3 stars 2 forks source link

Proto.Persistence.SqlServer does not support irregular identifiers #1

Closed ryanjshaw closed 4 years ago

ryanjshaw commented 6 years ago

I have found it convenient to use '.' in my actor names, and child actors spawned have a '/' in their name automatically. I also find it convenient to split the state of actors into separate tables for performance and debugging purposes. Unfortunately the characters I mentioned are iirregular identifiers so they must be delimited when used as the table name for persistence.

Currently the SQL in https://github.com/AsynkronIT/protoactor-dotnet/blob/dev/src/PersistenceProviders/Proto.Persistence.SqlServer/SqlServerProvider.cs does not delimit identifiers [1], so only actor names containing regular identifiers [2] will work with the SQL Server persistence driver.

I can workaround it by replacing irregular identifiers but that looks inconsistent with my logs (which include actor names) and increases the risk of a namespace collision.

This is straightforward to fix, happy to do it if there is agreement that it be done?

[1] https://technet.microsoft.com/en-us/library/ms176027%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396 [2] https://technet.microsoft.com/en-us/library/ms175874%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396

raskolnikoov commented 6 years ago

@ryanjshaw sure make a PR to fix this if you want.

alexeyzimarev commented 4 years ago

As I understand the change is trivial like replacing

SELECT EventIndex, EventData FROM {_tableSchema}.{_tableEvents}

by

SELECT EventIndex, EventData FROM [{_tableSchema}].[{_tableEvents}]

right?