Hi,
Is there anything in the framework that might get in the way of overriding the default name and type for an entities PK please?
Marking a property like this results in the right primary key being defined:
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid SupplierId { get; set; }
However, the EF default of "Id" is still created. Naming a property "<EntityClassName>Id" should suppress this:
[attachment=0:ji9x8gu7]Capture.JPG[/attachment:ji9x8gu7] Thanks for any guidance.
Cheers,
Thanks hikalkan.
For those who are interested, to override Id with guid datatype and also implement the full audit log pattern, do this:
[Table("Supplier")]
public class Supplier : **FullAuditedEntity<Guid>**
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override Guid Id { get; set; }
Hi,
I have overridden the Id for all entities with code like this:
[Table("Supplier")]
public class Supplier : FullAuditedEntity<Guid>
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override Guid Id { get; set; }
All works good for DB migrations etc.
However, when trying to create a service for my entities, I get this:
The type 'goMapDo_Offer.gmdSupplier.Supplier' cannot be used as type parameter 'TEntity' in the generic type or method 'IRepository<TEntity>'. There is no implicit reference conversion from 'goMapDo_Offer.gmdSupplier.Supplier' to 'Abp.Domain.Entities.IEntity<int>'
This is because the IRepository interface only supports int:
public interface IRepository<TEntity> : IRepository<TEntity, int>, IRepository, ITransientDependency where TEntity : class, IEntity<int>
I can live with SQL Server type BigInt instead of Int (which just will not store enough values) and have done this instead:
public class Supplier : FullAuditedEntity<Int64>
However, I would prefer to use Guid for architectural reasons (pre-generation).
Any suggestions please?
I notice that the auth classes uses bigint so assume the ABP framework will handle it okay? I mean, not starting weird errors when Ids go beyond 2,147,483,647? Which, in my site, it soon will.
However, if you think I am going to hit subtle issues like this all over the place when using Guid, I will stick with BigInt.
Apologies for the long post.
Cheers.
Thanks hikalkan & bytePlatz. Appreciate the quick response.
Hi,
Sorry for what is probably a beginner question.
I am confident that I have wired up my new app service properly for WebApi as I can call it in Chrome developer tools:
[attachment=2:cz22gv4t]Capture.JPG[/attachment:cz22gv4t] [attachment=1:cz22gv4t]Capture2.JPG[/attachment:cz22gv4t]
However, when I try and call the service in the AngularJS controller I get "h = Object doesn't support property or method 'GetSupplierforCurrentUserAsync'"
In debug mode, I can see that the service is instantiated and the method is available:
[attachment=0:cz22gv4t]Capture3.JPG[/attachment:cz22gv4t]
Are you able to give me a pointer as to what is going wrong please? Full JS code:
(function () {
appModule.controller('tenant.views.dashboard.index', [
'$scope', 'abp.services.app.tenantDashboard', 'abp.services.app.supplier',
function ($scope, tenantDashboardService, supplierService) {
var vm = this;
$scope.$on('$viewContentLoaded', function () {
Metronic.initAjax();
});
....
vm.getMemberActivity();
vm.SupplierName = "";
supplierService.GetSupplierforCurrentUserAsync({}).success(function (result) {
vm.SupplierName = result.Name;
});
All good. Many thanks for the quick response.
Is it possible to make modals draggable?
I have tried adding the 'draggable-modal' class to various <DIV> elements on the modal like this:
<div class="draggable-modal">
<form name="userCreateOrEditLocationForm" role="form" novalidate class="form-validation">
<div class="modal-header draggable-modal" style="background-color: #9eacb4; color:white">
<h4 class="modal-title">
<span>Edit Location</span>
</h4>
</div>
<div class="modal-body">
And by passing in options in the JS call like this:
vm.editLocation = function () {
var modalInstance = $modal.open({
templateUrl: '~/App/tenant/views/location/createOrEditLocationModal.cshtml',
controller: 'common.views.users.createOrEditLocationModal as vm',
windowTopClass: 'draggable-modal',
backdrop: 'static'//,
Any ideas please?
Try profileService.getCurrentUserDemographicForEdit (i.e. lowercase get).
The DI camel cases function calls.
Okay, thanks for the info, I will have a look.