Some code:
This is your new entity (place it somewhere in YourProject.Core project):
[Table("ReBid")]
public class Bid : FullAuditedEntity<long> {
public Bid() {
CreationTime = Clock.Now;
}
[DataType(DataType.Currency)]
[Column(TypeName = "money")]
[Range(0, double.MaxValue)]
public decimal Amount { get; set; }
public long RegistrationId { get; set; }
[ForeignKey("RegistrationId")]
public virtual BidderRegistration Registration { get; set; }
/// <summary>True if this is the winning bid of an auction</summary>
public bool IsWinner { get; set; }
}
Then add the proper IDbSet in the DbContext class you find in YourProject.EntityFramework project:
public class YourProjectDbContext : AbpZeroDbContext<Tenant, Role, User> {
...
public virtual IDbSet<Bid> Bids { get; set; }
...
}
What do you mean?
Would you like to read data from a repository and copy them to your main repo to be seed, or what?
And so? Do we have the solution? Also I'd like to have a login via Angular.
At the moment I have the home page working anonymous (I achieved it with a small fix. see <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/pull/57">https://github.com/aspnetboilerplate/mo ... te/pull/57</a>) and now I'd like to a add a popup window for login via Angular WebApi
As you know, no validation code is required for validating input Dtos in Application Services, as it is automatically done by the framework, possibly calling custom validation too.
Is there a way to define a similar mechanism before returning the output Dto? I'd like to filter the Dto by blanking some values according to current AbpSession user and I'd like to do it outside the application service method.
I am sure it is possible, but I sincerely do not know how to realize it.
I have been using the AngularJs SPA template.
Thank you for your help, Gianpiero
In EF, database commits are normally visible only at the end of the transaction or once you call the commit() method or scope.complete() method.
If you take a look to the Abp Unit of Works source code you see:
protected override void CompleteUow()
{
SaveChanges();
if (CurrentTransaction != null)
{
CurrentTransaction.Complete();
}
DisposeUow();
}
protected override async Task CompleteUowAsync()
{
await SaveChangesAsync();
if (CurrentTransaction != null)
{
CurrentTransaction.Complete();
}
DisposeUow();
}
It follows the same approach of teh EF.
So, to close, these are the main reasons you don't see your changes in the DB.
I suggest you two approaches:
Further info here: <a class="postlink" href="https://msdn.microsoft.com/en-us/data/dn456843.aspx">https://msdn.microsoft.com/en-us/data/dn456843.aspx</a>
For the first question, see: <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/pull/57">https://github.com/aspnetboilerplate/mo ... te/pull/57</a>
You have to remove the attribute
[AutoMapFrom(typeof(Article))]
and create your own map.
From Abp v. 1.0.0 this can be done in Abp MVC and SPA template in the "Application" project. See YourProjectApplicationModule.cs. There you can find something like:
public override void PreInitialize()
{
Configuration.Modules.AbpAutoMapper().Configurators.Add(mapper =>
{
//Add your custom AutoMapper mappings here...
//mapper.CreateMap<,>()
...
});
}
Gp
See: <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/issues/56">https://github.com/aspnetboilerplate/mo ... /issues/56</a>
And: <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/pull/57">https://github.com/aspnetboilerplate/mo ... te/pull/57</a>
Let's have a some business method returning users details:
public async Task<MyUserDto> getUserInfo(int id);
... and other similar methods...
And Let's suppose I want to return some sensible information about the user only to specific users (e.g. having view.full.info permission)
Where do you think it is the best way where to hide these info?
I'd working on MyUserDto by implementing the ICustomValidate interface where I check the current user in session and null the sensible information according to its permissions.
But I am not sure...
tnx for your help! Gp
Hi, I am trying to implement a method into a service that create a user and then assign a role to it.
The problem is that to assign the role, I need the User.Id of the created user and I have not it but any FindBy into the same transaction return null due to the fact (I think) I am into the unit of work:
public class UserAppService : MyNewHouseAppServiceBase, IUserAppService {
// ....
public async Task CreateAdmin(CreateUserInput input) {
var user = input.MapTo<User>();
(await UserManager.CreateAsync(user)).CheckErrors(LocalizationManager);
var u = await UserManager.FindByNameAsync(input.UserName); // <-- this returns null!!!
(await UserManager.AddToRoleAsync(u.Id, StaticRoleNames.Tenants.Admin)).CheckErrors(LocalizationManager);
}
}
I can I get the user.Id by staying into the unit of work? I wish to have the operation all transaction.
Tnx gp