|
|
@@ -50,7 +50,7 @@ namespace InvercargillSql.Orm {
|
|
|
* @return A new Query<T> instance appropriate for type T
|
|
|
* @throws SqlError.GENERAL_ERROR if T is neither a registered entity nor projection
|
|
|
*/
|
|
|
- public Query<T> query<T>() throws SqlError {
|
|
|
+ public Query<T> query<T>() throws Error {
|
|
|
var type = typeof(T);
|
|
|
|
|
|
// Check if it's a registered entity
|
|
|
@@ -77,7 +77,7 @@ namespace InvercargillSql.Orm {
|
|
|
* @param entity The entity to insert
|
|
|
* @throws SqlError if insertion fails
|
|
|
*/
|
|
|
- public void insert<T>(T entity) throws SqlError {
|
|
|
+ public void insert<T>(T entity) throws Error {
|
|
|
var mapper = get_mapper<T>();
|
|
|
Invercargill.Properties properties;
|
|
|
try {
|
|
|
@@ -130,7 +130,7 @@ namespace InvercargillSql.Orm {
|
|
|
* @param entity The entity to update
|
|
|
* @throws SqlError if update fails
|
|
|
*/
|
|
|
- public void update<T>(T entity) throws SqlError {
|
|
|
+ public void update<T>(T entity) throws Error {
|
|
|
var mapper = get_mapper<T>();
|
|
|
Invercargill.Properties properties;
|
|
|
try {
|
|
|
@@ -175,7 +175,7 @@ namespace InvercargillSql.Orm {
|
|
|
* @param entity The entity to delete
|
|
|
* @throws SqlError if deletion fails
|
|
|
*/
|
|
|
- public void delete<T>(T entity) throws SqlError {
|
|
|
+ public void delete<T>(T entity) throws Error {
|
|
|
var mapper = get_mapper<T>();
|
|
|
Invercargill.Properties properties;
|
|
|
try {
|
|
|
@@ -217,7 +217,7 @@ namespace InvercargillSql.Orm {
|
|
|
* @return The EntityMapper<T> for type T
|
|
|
* @throws SqlError if no mapper is registered for type T
|
|
|
*/
|
|
|
- public EntityMapper<T> get_mapper<T>() throws SqlError {
|
|
|
+ public EntityMapper<T> get_mapper<T>() throws Error {
|
|
|
return _type_provider.get_mapper<T>();
|
|
|
}
|
|
|
|
|
|
@@ -227,41 +227,17 @@ namespace InvercargillSql.Orm {
|
|
|
* @param type The entity type to look up
|
|
|
* @return The EntityMapper for the type, or null if not registered
|
|
|
*/
|
|
|
- public EntityMapper? get_mapper_for_type(Type type) {
|
|
|
+ public EntityMapper? get_mapper_for_type(Type type) throws Error {
|
|
|
return _type_provider.get_mapper_for_type(type);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * Creates a query for a projection type.
|
|
|
- *
|
|
|
- * @deprecated Use query<T>() instead, which automatically detects
|
|
|
- * whether T is an entity or projection type.
|
|
|
- *
|
|
|
- * For projections, returns ProjectionQuery<TProjection> for read-only queries.
|
|
|
- *
|
|
|
- * @return A new ProjectionQuery<TProjection> instance
|
|
|
- * @throws ProjectionError.PROJECTION_NOT_REGISTERED if projection is not registered
|
|
|
- */
|
|
|
- [Deprecated (replacement = "query<T>()", since = "0.1")]
|
|
|
- public ProjectionQuery<TProjection> query_projection<TProjection>()
|
|
|
- {
|
|
|
- var type = typeof(TProjection);
|
|
|
- var definition = _type_provider.get_projection_for_type(type);
|
|
|
- if (definition == null) {
|
|
|
- throw new ProjectionError.PROJECTION_NOT_REGISTERED(
|
|
|
- @"Projection of type $(type.name()) is not registered"
|
|
|
- );
|
|
|
- }
|
|
|
- var sql_builder = new ProjectionSqlBuilder(definition, _dialect);
|
|
|
- return new ProjectionQuery<TProjection>(this, definition, sql_builder);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Gets the projection definition for a type.
|
|
|
*
|
|
|
* @return The ProjectionDefinition for the type, or null if not registered
|
|
|
*/
|
|
|
- public ProjectionDefinition? get_projection_definition<TProjection>()
|
|
|
+ public ProjectionDefinition? get_projection_definition<TProjection>() throws Error
|
|
|
{
|
|
|
return _type_provider.get_projection<TProjection>();
|
|
|
}
|
|
|
@@ -272,7 +248,7 @@ namespace InvercargillSql.Orm {
|
|
|
* @param type The projection type to look up
|
|
|
* @return The ProjectionDefinition for the type, or null if not registered
|
|
|
*/
|
|
|
- public ProjectionDefinition? get_projection_definition_for_type(Type type) {
|
|
|
+ public ProjectionDefinition? get_projection_definition_for_type(Type type) throws Error {
|
|
|
return _type_provider.get_projection_for_type(type);
|
|
|
}
|
|
|
|