I want to seed some tenant related data when a Tenant is created.
This is where I think I should seed data :
protected override void Seed(EntityFramework.CORPACCOUNTINGDbContext context) { context.DisableAllFilters();
if (SeedMode == SeedMode.Host)
{
//Host seed
new InitialHostDbBuilder(context).Create();
//Default tenant seed (in host database).
new DefaultTenantBuilder(context).Create();
new TenantRoleAndUserBuilder(context, 1).Create();
}
else if(SeedMode == SeedMode.Tenant)
{
// Here is where I plan to seed the data.
}
context.SaveChanges();
}
But how do I get the tenant to insert data by Tenant
Hi -
I am getting errors after updating to Abp 0.9.0. I guess you need to release the Abp Zero upgraded version as well else I am unable to proceed further. Some of the errors are :
1)No overload for method 'SubscribeToAllAvailableNotificationsAsync' takes 2 arguments
Argument 4: cannot convert from 'long[]' to 'Abp.UserIdentifier[]'
cannot convert from 'long' to 'Abp.UserIdentifier'
Hi Hilkan -
I am implementing some kind of access restriction into my application.
Let's say I have multiple entities Entity A, B,C which I want to provide restrictive access to certain users.
For that I am planning to use data filters, IMayHaveUserRestriction.
I created the interface as well , but I can't implement this in my Entity A else it would create a column UserId in Entity A ,B,C which I definitely don't want.
My restriction rules or data are placed in a another Entity called Entity R.
The whole idea is to create a data filter which I can use it in any entity and it would filter based on some rules.
Could you guide me how to do this using Abp ?
Thanks, Partha
I was trying to move the AbpTables from dbo. to xxx. using the latest changes
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder);
modelBuilder.ChangeAbpTablePrefix<Tenant, Role, User>(string.Empty,"xxx");
}
When I run the migration I get this issue while seeding :
Running Seed method. System.Data.SqlClient.SqlException (0x80131904): Cannot find the object "BackgroundJobs" because it does not exist or you do not have permissions.
ClientConnectionId:5c2bb018-df94-40df-8044-a3dc537b3e1a Error Number:4902,State:1,Class:16
Any Ideas ?
The json returned by abp has place holder for Error Message, but I am not sure how to send a Success Message. There are instances where I would like to send a customized success message.
Is there a way to handle it ?
Thanks, Partha
Hi -
I am now building an application where in I have asked the UI developers not to put any validation as of now so that I want to make sure all validations are present for the middle tier and also for the web services.
So when I submit a form the validation message returned by Abp is something like this :
The UserName is required. My problem is UserName is the column name, but when I put DisplayName in the DTO for "UserName" it doesn't recognize it. I would like to show an user friendly message like The User Name is required instead of the datbase column name or DTO property name.
Can you let me know where to make the changes?
Hi Hilkan -
I am moving the UI from Angular JS to Ext JS and facing an issue.
When I write Abp.Session in my console I am getting all the properties liek UserID and TenantID
But when I write Abp.services.app it's not getting any properties. I am guessing I am missing some script files to include in my ExtJS screen.
Everything works fine when I am using Angular JS
Could you please help on how i move the code from Angular JS to some other UI without breaking or losing anything.
Hi Hilkan -
This is not something directly related to Abp but I would like some guidance on it. I would like your input in designing my core layer where in the display attribute retrieves data dynamically from the database. Some thing like the below :
[Display(Name = "get data from database based on some query")]
Is this a good idea ?
The whole idea is I would like to provide flexibility to my users to change the display name of the database columns based on their wish. So any guidance for implementation would be helpful.
Thanks in Advance.
Hi-
I was trying to use Join using two repositories from two different databases :
var Xlist = _xxxxxxx.GetAllList(o => o.CreationTime >= givenDate).GroupBy(u => new { u.SomeId, u.SomeId2 })
.Select(group => new {Column1 = group.Key.SomeId, SomeId2 = group.Key.SomeId2, Column2 = group.Count(o => o.Deid != null), Column3 = group.Count(o => o.IsProcessed == true), RejectedCount = group.Count(o => o.IsRejected == true), ToTotalFileCOunttal = group.Count() })
.Join(xxxxxxxx.GetAllList(),u => u.Column1, p => p.Id , (u, p) => new { u.Column1,u.SomeId2,u.Column2,u.Column3,u.RejectedCount,u.ToTotalFileCOunttal, p.table2Id })
.ToList();
I am getting the below error :
System.Data.Entity.Core.EntityException was unhandled by user code
HResult=-2146233087
Message=The underlying provider failed on Open.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectQuery
1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func1 operation) at System.Data.Entity.Core.Objects.ObjectQuery
1.GetResults(Nullable1 forMergeOption) at System.Data.Entity.Core.Objects.ObjectQuery
1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Castle.Proxies.EfRepositoryBase3Proxy_21.GetAllList_callback() at Castle.Proxies.Invocations.AbpRepositoryBase
2_GetAllList_50.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.EfRepositoryBase3Proxy_21.GetAllList() at CAPS.ONLINEDOC.CAPSONLINE.DashboardAppService.GetDashboardInfoPanel5(Char day) in C:\Source Code\CAPSONLINEDOC_NEW\CAPS.ONLINEDOC.Application\CAPSONLINE\DashboardAppService.cs:line 123 at Castle.Proxies.Invocations.IDashboardAppService_GetDashboardInfoPanel5.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Auditing.AuditingInterceptor.PerformSyncAuditing(IInvocation invocation, AuditInfo auditInfo) InnerException: HResult=-2146233087 Message=The transaction has aborted. Source=System.Transactions StackTrace: at System.Transactions.TransactionStateAborted.CheckForFinishedTransaction(InternalTransaction tx) at System.Transactions.Transaction.Promote() at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction) at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts) at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts) at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx) at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action
2 operation, TInterceptionContext interceptionContext, Action3 executing, Action
3 executed)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func1 operation) at System.Data.Entity.Core.EntityClient.EntityConnection.Open() InnerException: HResult=-2146233087 Message=Failure while attempting to promote transaction. Source=System.Data StackTrace: at System.Data.SqlClient.SqlDelegatedTransaction.Promote() at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx) at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx) InnerException: Class=16 ErrorCode=-2146232060 HResult=-2146232060 LineNumber=1 Message=MSDTC on server 'PMAHARATH-IT-L' is unavailable. Number=8501 Procedure="" Server=. Source=.Net SqlClient Data Provider State=3 StackTrace: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlDelegatedTransaction.Promote()
InnerException:
Hi All -
I am trying to connect to another database from my application and get some values from multiple tables. I am trying to use a secondary DB context for which I have declared a connection string as
<add name="Second" connectionString="Server=myserverinstance; Database=myseconddb; Trusted_Connection=True;" providerName="System.Data.SqlClient" />
Then trying to use the code to connect like the below :
using (var context = new ONLINEDOCDbContext("Second")) { context. <<this gives me the list of tables from the first database instead of my seocnd database>>
}
Am I doing something wrong here ?
Please guide.
The whole idea is to access multiple database using different DB context. Please provide an implmenetation.
Thanks for your wonderful support so far.