Base solution for your next web application

Activities of "rafalpiotrowski"

Hi, I donwloaded latest version of 'dev' from git building solution works running IISExpress works npm start works without errors

but when I run <a class="postlink" href="http://localhost:4200">http://localhost:4200</a>

I receive the following error ERROR Error: Uncaught (in promise): Error: No provider for LoginService! Error: No provider for LoginService! at ReflectiveInjector_.prototype._throwOrNull (<a class="postlink" href="http://localhost:4200/vendor.bundle.js:140837:13">http://localhost:4200/vendor.bundle.js:140837:13</a>) ... at createViewNodes (<a class="postlink" href="http://localhost:4200/vendor.bundle.js:150393:17">http://localhost:4200/vendor.bundle.js:150393:17</a>)

Any idea what is wrong?

Hi, I am trying to add migration but it failes. Where should I look for more detailed information on the reason why it failes. All solution builds sucessfully!!!

PM> Add-Migration XXXXXXX -Verbose -Debug Using project 'src\MyCompanyName.AbpZeroTemplate.EntityFrameworkCore'. Using startup project 'src\MyCompanyName.AbpZeroTemplate.Web.Host'. Build started... Build failed. PM>

Hi, I have extended User entity like below:

public class User : AbpUser<User>
    {
        public const int MaxPhoneNumberLength = 24;
.....
        //Can add application specific user properties here
        public MyCompanyName.AbpZeroTemplate.XXX.Address HomeAddress { get; set; }

by adding HomeAddress of class Address

Address class looks like this:

namespace MyCompanyName.AbpZeroTemplate.XXX
{
    public class Address : ValueObject<Address>
    {
        public Country Country { get; set; } //A reference to a Country entity.
        public string City { get; set; }
        public string Street { get; set; }
        public string PostalCode { get; set; }
        public int? Number { get; set; }

        public Address()
        {
        }

        public Address(Country country, string city, string street, int? number, string postalCode)
        {
            Country = country;
            City = city;
            Street = street;
            Number = number;
            PostalCode = postalCode;
        }
    }

    [Table("Countries")]
    public class Country : FullAuditedEntity<int>, IMustHaveTenant
    {
        public int TenantId { get; set; }

        /// <summary>
        /// ISO 3166 Codes
        /// </summary>
        public virtual string CodeA2 { get; set; }
        /// <summary>
        /// ISO 3166 Codes
        /// </summary>
        public virtual string CodeA3 { get; set; }
        public virtual string Name { get; set; }

        public Country() { }
        public Country(string codeA2, string codeA3, string name) { CodeA2 = codeA2; CodeA3 = codeA3; Name = name; }
    }
}

Thanks to the upgrade to EFCore 2.0 we are able to use ValueObjects and thats great! It works, AbpUsers table is extended with HomeAddress_XYZ columns as per class structure above. It has HomeAddress_CountryId as the foreign id. all is good.

Problem comes when we edit an user, call to:

[AbpAuthorize(AppPermissions.Pages_Administration_Users_Create, AppPermissions.Pages_Administration_Users_Edit)]
        public async Task<GetUserForEditOutput> GetUserForEdit(NullableIdDto<long> input)
        {
...
               //Editing an existing user
                var user = await UserManager.GetUserByIdAsync(input.Id.Value);
// !!! HERE: user has HomeAddress set to an instance of Address, but HomeAddress.Country is null !!!
...
}

variable user has HomeAddress set to an instance of Address, but HomeAddress.Country is null !!!

Is it possible to do some kind of an include on Country class or something to let know the UserManager to extract country data?

thanks

Question

Hi, When can we expect the SignalR to work with ASPNET Core and Angular?

Question

Hi, when can we expect to see version with EF Core 2.0 ?

Hi, trying to do ng build --prod and get the following error

this is version as per 30th june 2017 from dev branch

ERROR in C:/.../angular/src/$$_gendir/app/shared/layout/footer.component.ngfactory.ts (47,79): Property 'editionDisplayName' does not exist on type 'TenantLoginInfoDto'.

I have ValueObject that later is a prop of an Entity VO is Address below

public class Address : ValueObject<Address>
    {
        public int CountryId { get; private set; } //A reference to a Country entity.
        public string City { get; private set; }

        public string Street { get; private set; }

        public string PostalCode { get; private set; }

        public int Number { get; private set; }

        public Address(int countryId, string city, string street, int number, string postalCode)
        {
            CountryId = countryId;
            City = city;
            Street = street;
            Number = number;
            PostalCode = postalCode;
        }
    }

When doing Add-Migration "whatever" I get

System.InvalidOperationException: The entity type 'Address' requires a primary key to be defined.
   at Microsoft.EntityFrameworkCore.Internal.ModelValidator.ShowError(String message)
   at Microsoft.EntityFrameworkCore.Internal.ModelValidator.Validate(IModel model)
   at Microsoft.EntityFrameworkCore.Internal.RelationalModelValidator.Validate(IModel model)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
   at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.&lt;&gt;c__DisplayClass16_0.&lt;RealizeService&gt;b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.&lt;&gt;c__DisplayClass16_0.&lt;RealizeService&gt;b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.&lt;&gt;c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The entity type 'Address' requires a primary key to be defined.
PM>

In the ABP documentation I do not see the PK definition!

<a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/v2.0.1/Value-Objects">https://aspnetboilerplate.com/Pages/Doc ... ue-Objects</a>

Question

Where can I get ASP.NET Zero 4.1 from Git?

for those who wnat to connect different applications to the AspNetZero framework using REST API

the API has been auto-generated with Visual Studio 2017 using the "Add -> REST Api Client..." function Client Namespace: AspNetZeroWebHost Swagger Url: <a class="postlink" href="http://localhost:22742/swagger/v1/swagger.json">http://localhost:22742/swagger/v1/swagger.json</a>

then just use the AspNetZeroWebHostClient to call the server

var credentials = new TokenCredentials("what ever here");
                var client = new AspNetZeroWebHost.AspNetZeroWebHostClient(new Uri("http://localhost:22742", UriKind.Absolute), credentials);
                var customHeaders = new Dictionary<string, List<string>>
                {
                    { "Abp.TenantId", new List<string> { "1" } }
                };
                Task<HttpOperationResponse<AuthenticateResultModel>> ar = client.ApiTokenAuthAuthenticatePostWithHttpMessagesAsync(
                    new AspNetZeroWebHost.Models.AuthenticateModel("username", "userpassword"),
                    customHeaders);
                ar.Wait();

                customHeaders.Add("Authorization", new List<string> { "Bearer " + ar.Result.Body.AccessToken });

                var aa = client.ApiTokenAuthGetExternalAuthenticationProvidersGetWithHttpMessagesAsync(customHeaders);
                aa.Wait();

Important thing: The generated code has one problem when deserializing the respinse. Work arround is:

  1. add wrapper class
public static class AnzSafeJsonConvert
    {
        /// <summary>
        /// Wrapper arround SafeJsonConverter.DeserializeObject to parse json return from the AspNetZero Swagger response
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="json"></param>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static T DeserializeObject<T>(string json, JsonSerializerSettings settings)
        {
            var a = SafeJsonConvert.DeserializeObject<Dictionary<string, object>>(json, settings);
            var b = a.ToArray()[0];
            var jsonResult = b.Value.ToString();
            return SafeJsonConvert.DeserializeObject<T>(jsonResult, settings);
        }
    }

then replace each occurence of:

_result.Body = SafeJsonConvert.DeserializeObject<...

with:

_result.Body = YourProjectNameSpace.AnzSafeJsonConvert.DeserializeObject<...

hope this helps

of course, this is not plug and play so you do need to make some changes to the above code, but I am sure you all will know what to change

if anyone has found better solution, let me know

Question

under which class I find mt-cookie-consent-bar

Showing 21 to 30 of 32 entries