Hi
Two questions here
Firstly, I am trying to remove the cascade delete conventions using modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>()
However it gives me a migration file with the following entries
public override void Up() { DropForeignKey("dbo.AbpFeatures", "EditionId", "dbo.AbpEditions"); DropForeignKey("dbo.AbpPermissions", "RoleId", "dbo.AbpRoles"); DropForeignKey("dbo.AbpUserClaims", "UserId", "dbo.AbpUsers"); DropForeignKey("dbo.AbpUserLogins", "UserId", "dbo.AbpUsers"); DropForeignKey("dbo.AbpPermissions", "UserId", "dbo.AbpUsers"); DropForeignKey("dbo.AbpUserRoles", "UserId", "dbo.AbpUsers");
AddForeignKey("dbo.AbpFeatures", "EditionId", "dbo.AbpEditions", "Id");
AddForeignKey("dbo.AbpPermissions", "RoleId", "dbo.AbpRoles", "Id");
AddForeignKey("dbo.AbpUserClaims", "UserId", "dbo.AbpUsers", "Id");
AddForeignKey("dbo.AbpUserLogins", "UserId", "dbo.AbpUsers", "Id");
AddForeignKey("dbo.AbpPermissions", "UserId", "dbo.AbpUsers", "Id");
AddForeignKey("dbo.AbpUserRoles", "UserId", "dbo.AbpUsers", "Id");
}
Hence it is removing the cascade deletes from some core tables that came with Aspnet boiler plate, which I don't want to do. To overcome this behavior I added this piece of code below after the call to modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
modelBuilder.Entity<Role>().HasMany(r => r.Permissions).WithRequired().WillCascadeOnDelete(true);
modelBuilder.Entity<User>().HasMany(u => u.Roles).WithRequired().WillCascadeOnDelete(true);
modelBuilder.Entity<User>().HasMany(u => u.Permissions).WithRequired().WillCascadeOnDelete(true);
modelBuilder.Entity<User>().HasMany(u => u.Logins).WithRequired().WillCascadeOnDelete(true);
modelBuilder.Entity<User>().HasMany(u => u.Claims).WithRequired().WillCascadeOnDelete(true);
This works and now the only entry I get in the migration file is DropForeignKey("dbo.AbpFeatures", "EditionId", "dbo.AbpEditions"); AddForeignKey("dbo.AbpFeatures", "EditionId", "dbo.AbpEditions", "Id");
Basically, this is because I have not been able to locate the AbpFeature and AbpEdition tables that have access to the Edition Id and the Edition collection. Can you refer me to the code classes for these tables.
Secondly, where do I view the logs. There is a logs.txt on my dev environment, but cannot seem to find this file on production (IIS). Is there a config setting that I have to change somewhere for logs to be displayed on the server. I see there is a AbpAuditLogs table in the database, however it does not store the errors that are thrown when incorrect data is passed through the REST api in swagger.
Thanks for all the help..
Hi
There are two contexts in my application, one is the standard context and the other the database first context which talks to another database.
Normal context public class NormalContext : AbpZeroDbContext<Tenant, Role, User>
and Database first context
public class MyDbContext : AbpDbContext
I need to fetch some information from NormalContext within the MyDbContext. I am currently using the following function in MyDbContext
private string GetUserName(long? userId)
{
if (userId == null)
return null;
using (var context = LocalIocManager.Resolve<NormalContext >())
{
var user = context.Users.Find(userId);
return user.Name;
}
}
However this throws an exception
nHandling.AbpApiExceptionFilterAttribute - The underlying provider failed on Open. System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Transactions.TransactionAbortedException: The transaction has aborted. ---> System.Transactions.TransactionPromotionException: Failure while attempting to promote transaction. ---> System.Data.SqlClient.SqlException: MSDTC on server 'PC120' is unavailable.
PC120 is the local server that hosts the database for the NormalContext .
I dont know if I am resolving the NormalContext in the right manner.
Any help would be appreciated here.
Hi.
I have a simple class
public class Car : Entity{
public virtual DateTime AddDate {get;set;} // retrieved from the Session object public virtual DateTime UpdateDate { get;set;} public virtual string UserName{ get; set; } }
I am using the AsyncCrud Interface. However I want to factor out these properties in a base object and set them everytime the user creates or updates an entity. so that these are updated for all objects automatically. I cannot use the built in AuditedEntity class since this is a database first context.
I cannot seem to do this at the Core layer or the entity framework layer (plus session object is available on at the services layer). Can you please specify how this is achieved. I also do not want to pass this information in the DTO objects. It should be set by default whenever a new object is created or updated. Your help will be greatly appreciated.
Regards
Dear Support
I have a requirement to read/write data to another database, however i don't want to run migration on that database ... is that possible.
I have seen a sample project which shows you how to talk to multiple databases however migrations are enabled on both databases.
Thanks in advance for your help
Dear Support
I am wanting to use the CrudAppService and/or AsyncCrudAppService and it works great when mapped to one Table/Entity which has no relationships with other tables/entities.
However, when I have a table which has a relationship with another table/entity i.e. "ICollection<Phone> Phones" part of the Person Class I am unable to use the update method to update the phones collection in the Person Object.
Can you please let me know if this AppService can update multiple tables/entities which have a relationship??
Thanks and KInd Regards vnetonline
I am trying to use the JWT Token Authentication by using postman to request a token by going to the following address
<a class="postlink" href="http://localhost:6240/jwt-token/authenticate">http://localhost:6240/jwt-token/authenticate</a>
I am getting a Status 200 OK, however i am having the following response
<!DOCTYPE html>
<html lang="en" dir=>
<head>
<meta charset="utf-8" />
<title>AppConnect</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="AppConnect" name="description" />
<meta content="AppConnect" name="keywords">
<meta content="AppConnect" name="author" />
<link rel="shortcut icon" href="/favicon.ico" />
<link href="/Content/fonts-open-sans.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/Content/font-awesome.min.css?v=636175753326229755" />
<link rel="stylesheet" type="text/css" href="/libs/simple-line-icons/simple-line-icons.min.css?v=636175753462769460" />
<link rel="stylesheet" type="text/css" href="/libs/bootstrap/css/bootstrap.min.css?v=636175753350929457" />
<link rel="stylesheet" type="text/css" href="/libs/jquery-uniform/css/uniform.default.css?v=636175753424449461" />
<link rel="stylesheet" type="text/css" href="/metronic/assets/global/css/components-md.css?v=636175753516409495" />
<link rel="stylesheet" type="text/css" href="/metronic/assets/global/css/plugins-md.css?v=636175753518069477" />
<link rel="stylesheet" type="text/css" href="/Views/Error/_Layout.css?v=636175753704869461" />
<script type="text/javascript">
var abp = abp || {}; abp.appPath = '/';
</script>
</head>
<body class="page-404-full-page">
<div class="row">
<div class="col-md-12 page-404">
<div class="number font-red"> 404 </div>
<div class="details">
<h3>Oops! You're lost.</h3>
<p>
We can not find the page you're looking for.
<br>
<a href="/" class="link">Home page</a>.
</p>
</div>
</div>
</div>
<script src="/libs/jquery/jquery.min.js?v=636175753388689445" type="text/javascript"></script>
<script src="/libs/bootstrap/js/bootstrap.min.js?v=636175753352659830" type="text/javascript"></script>
<script src="/libs/jquery-blockui/jquery.blockui.min.js?v=636175753389339473" type="text/javascript"></script>
<script src="/libs/jquery-uniform/jquery.uniform.min.js?v=636175753423909460" type="text/javascript"></script>
<script src="/libs/jquery-cookie/jquery.cookie.min.js?v=636175753389519557" type="text/javascript"></script>
<script type="text/javascript">
abp.localization.defaultSourceName = 'AppConnect';
</script>
<script src="/AbpScripts/GetScripts?v=636190858995785233" type="text/javascript"></script>
<script src="/libs/jquery-validation/js/jquery.validate.min.js?v=636175753426729463" type="text/javascript"></script>
<script src="/libs/jquery-validation/js/localization/_messages_empty.js?v=636175753445940001" type="text/javascript"></script>
<script src="/metronic/assets/global/scripts/app.js?v=636175753556739463" type="text/javascript"></script>
<script type="text/javascript">
App.setAssetsPath(abp.appPath + 'metronic/assets/');
</script>
<script src="/Common/Scripts/appUserNotificationHelper.js"></script>
<script src="/Common/Scripts/consts.js"></script>
<script src="/Common/Scripts/helpers.js"></script>
<script src="/Common/Scripts/jquery-custom.js"></script>
<script src="/Common/Scripts/jquery-validation-custom.js"></script>
<script src="/Common/Scripts/librarySettings.js"></script>
<script src="/Common/Scripts/ModalManager.js"></script>
<script src="/Common/Scripts/passwordComplexityHelper.js"></script>
<script src="/Common/Scripts/utils.js"></script>
<script src="/Common/Scripts/Chat/chat.js"></script>
<script src="/Common/Scripts/Chat/chat.signalr.js"></script>
<script src="/Common/Scripts/LocalStorage/localStorage.js"></script>
<script src="/Common/Scripts/LocalStorage/localStorage.localForage.js"></script>
<script src="/metronic/assets/admin/layout/scripts/layout.js?v=636175753494969559" type="text/javascript"></script>
<script>
jQuery(document).ready(function () {
if (CurrentPage) {
CurrentPage.init();
}
});
</script>
<script type="application/json" id="__browserLink_initializationData">
{"appName":"Chrome","requestId":"c80ccfa8caaf49bd9489d156587d9201"}
</script>
<script type="text/javascript" src="http://localhost:1853/fc4f53901f894a9daa652325c09bfb01/browserLink" async="async"></script>
</body>
</html>
do i have to enable JWT Token based Authentication, according to the following documentation i have everything setup fine
<a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide-Core#authentication">https://aspnetzero.com/Documents/Develo ... entication</a>
Dear Halil
I am planning to use aspnetzero as the backend for my ionic 2 mobile application and was wondering how long does the token last (i.e. Number of minutes in which it expires which) I get from /api/account/authenticate ... also is there a function to refresh if it is about to expire ??
Dear Halil
I was wondering when the SPA will be out with Angular 2 and TypeScript??
Thanks and kind regards Vineet Belani
Dear Support
I have changed the "Website Root Address" to {TENANCY_NAME}.mydomain.com in Host Settings.
I have also setup the wildcard hostname on Azure *.mydomain.com.
When I navigate to the site <a class="postlink" href="http://www.mydomain.com">http://www.mydomain.com</a> i can see the front end website.
When i click on the login button, I get the following error
Server Error in '/' Application.
There is no tenant defined with name www
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Abp.UI.UserFriendlyException: There is no tenant defined with name www
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[UserFriendlyException: There is no tenant defined with name www]
is this functionality normal, am i supposed to create a www tenant to access the back end?
Should i rename the default tenant to www?
Dear Support
I am trying to deploy the solution to Azure and when i Publish the below are the setting I am using. Are they right?
Why isn't there the option Enable Code First Migrations under Default and should Software DB context be there?
[attachment=0:1euoeeb9]Azure Settings.PNG[/attachment:1euoeeb9]