Base solution for your next web application

Activities of "boeseb"

No i refer to the dialog for publishing the page to a server.

If i publish the Abp project i don't get the option "Execute Code First Migrations" so i guessed VS cant do this if the DatabaseContext is in a library and not in the main project. In a text about deployment via web publish it says: "This check box is shown for databases that the application accesses by using an Entity Framework Code First context class. " But i am not sure if this is the case in ABP or if there is the possiblity to change it in a way to get the migration to work like this.

I will lookup the command line tool.

Thanks again for your great support

Thanks for your answer and hard work on ABP.

I added the reference in the main project now, but I am afraid i have another problem with deployment. Is there a way to get the migration of the database working with webdeploy? Currently i only get the databasescheme from my local test db copied to the target db. I would like to run the migrations on the server so the initial data from migration is also filled in the servers db. Is this another problem with VS that i dont get the option "Apply Migration" if its not in the main project?

With kind Regards, Sebastian

Hi,

Each time I use VisualStudio to deploy my project to our IIS server, the EntityFramework Provider specified in the EntityFramework-Project with all my repositories is missing in the deployment and I have to manually copy it to the IIS server to get the database access working.

When does WebDeploy include dependecies of a dependecy of the main project? How to include the EntityProvider in the deployment without reference it in the main project? Or should i reference it in the main project, isn't this bad for when i have to change the provider so i have to remeber to change it in two projects?

Sorry if this was already asked. I failed to find a topic that answers the question.

Hi again,

For my project i need to generate some dynamic pdf files, so the user can download them. I dont want to store them on disk, so i put code like this in my HomeController:

public class HomeController : MySpaControllerBase
    {
        IMyEntryAppService _myEntryService;
        public HomeController(IMyEntryAppService myEntryService)
        {
            _myEntryService=  myEntryService;
        }

        public void GetFile(long id)
        {
            EntryDto entry= _myEntryService.GetEntry(id); 

            using (MemoryStream workStream = new MemoryStream())
            {
                PdfDocument doc = new PdfDocument();               

                 doc.Info.Title = "Created with PDFsharp";

                // Create an empty page
                PdfPage page = doc.AddPage();

                // Get an XGraphics object for drawing
                XGraphics gfx = XGraphics.FromPdfPage(page);

                // Create a font
                XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);

                // Draw the text
                gfx.DrawString(entry.SomeProperty, font, XBrushes.Black,
                   new XRect(0, 0, page.Width, page.Height),
                  XStringFormats.Center);

                doc.Save(workStream);

                byte[] byteInfo = workStream.ToArray();
                Response.Buffer = true;
                Response.AddHeader("Content-Disposition", "attachment; filename= " + Server.HtmlEncode("MyGeneratedFile.pdf"));
                Response.ContentType = "APPLICATION/pdf";
                Response.BinaryWrite(byteInfo);
                doc.Close();
            }
        }
}

I feel this code doesnt belong there and would fit better in the MyEntryAppService. Is there a way to manipulate the ResponseHeader of the AppService response like in the controller or is there even a cleaner solution to achieve the dynamic file generation/download?

Kind Regards, Sebastian

Also my other problem is solved now. It had to do with the custom DependencyResolver. After setting it in my HubConfig getting a valid ConnectionManager from GlobalHost failed. So i got a not working HubContext. Setting the custom DependencyResolver in GlobalHost.DependencyResolver instead of only in the Hub Configuration fixed the problem. See [http://stackoverflow.com/a/31315380/4369295]) for code.

Thanks for the hint to the ContractResolver. I found following article that shows how to add a ContractResolver to SignalR

EDIT: I found this code but am not sure where i need to register the Serializer into the IoC container

using System;
using System.Reflection;
using Newtonsoft.Json.Serialization;
using SignalR;

namespace Loveboat.Configuration
{
    public class SignalRContractResolver : IContractResolver
    {
        private readonly Assembly _assembly;
        private readonly IContractResolver _camelCaseContractResolver;
        private readonly IContractResolver _defaultContractSerializer;

        public SignalRContractResolver()
        {
            _defaultContractSerializer = new DefaultContractResolver();
            _camelCaseContractResolver = new CamelCasePropertyNamesContractResolver();
            _assembly = typeof (Connection).Assembly;
        }

        #region IContractResolver Members

        public JsonContract ResolveContract(Type type)
        {
            if (type.Assembly.Equals(_assembly))
                return _defaultContractSerializer.ResolveContract(type);

            return _camelCaseContractResolver.ResolveContract(type);
        }

        #endregion
    }
}

And added this to the AbpModule Initialize Method:

var serializersettings = new JsonSerializerSettings {
                ContractResolver = new SignalRContractResolver()
            };

            var serializer = JsonSerializer.Create(serializersettings);
            IocManager.IocContainer.Register(Component.For<JsonSerializer>().Instance(serializer));

It works, but is there a better way to solve it?

Thanks for your fast response.

While trying to fix the problem i noticed some other issue with the serialization of objects from the AppService and the Serialization signalR is doing.

In serialized objects from AppService all properties of the serialized object start with a lower case letter in the javascript object. The same object sent via SignalR however has properties starting with a upper case letter. This difference is breaking my knockout bindings.

Is there a way to fix this?

Hi, i recently started to work with your awesome framework to create a new company internal application. I realy like how everything is just plugable with the convention based dependency injection but now i reacht my limit of understanding how all works together. I try to use a SignalR Hub to broadcast some Events on the EventBus to the connected Clients but this fails. For more Info pls see my post on stackoverflow where i already posted some code that i use to get things to work.

[http://stackoverflow.com/questions/31294992/use-signalr-as-broadcaster-for-eventbus-events])

i just thought i would leave a link here so some experts for abp could have a look at it and maybe help me out solving this problem or hint me to an even better solution =)

Thx in advance.

And special thanks to hikalkan for his awesome work!

Showing 1 to 8 of 8 entries