-
Notifications
You must be signed in to change notification settings - Fork 17
Enabling Usercontrol in System.Web #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
993ef59 to
9312f8c
Compare
9312f8c to
71b376e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a unit test?
Just saw that you do already have those. let's just get the implementation cleaned up a bit
| private async Task<T[]> GetDependencyPages(TemplateParser parser, CancellationToken token) | ||
| private static List<string> GetAllDependencies(string path) | ||
| { | ||
| var pageDependencyParser = new PageDependencyParser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this implementation? Does overriding the virtual methods in the UserContorlParser not work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you may want to override TemplateParser
internal virtual IEnumerable<string> GetDependencyPaths()
{
foreach (var t in TagRegisterEntries)
{
yield return t.VirtualPath;
}
}|
can you add tests for the following (feel free to mark them as skipped if they aren't working yet):
|
|
So thinking a bit more about this, reminds me of getting masterpage to work. It initially required a type as well - I then changed it to a "TypeReference":
with an update here: CoreWebForms/src/WebForms/UI/PageParser.cs Lines 634 to 640 in bb71e85
compare to referencesource: https://referencesource.microsoft.com/#System.Web/UI/PageParser.cs,534 It's unfortunate that WebForms "requires" the type to be available when just parsing - this change allowed that to be defered. Please see if you can do similarly. |
I actually had looked at the code for Master page.. let me see if I can fit that model here.. |
Ok you could get by Master page because MasterPage are kept under asp:Content and asp:ContentPlaceHolder both are recognizable (Content and ContentPlaceHolder) asp controls, so there is an already pre-defined types. While usercontrol are dynamic control, so there is no defined types. You can look at https://referencesource.microsoft.com/#System.Web/UI/TagNameToTypeMapper.cs,501 why master page are fine. Saying that, I think we need to build the dependency chain via sorting to build user control first, master page and web page. |
|
Let's work incrementally here so we can make sure we're doing it right. I think the following is a progression we can work through to get things finished up:
Thoughts? |
cd217ff to
6980ec0
Compare
|
Created this PR to handle first 3, will create another PR to resolve the last one |
twsouthwick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think (3) should be its own pr. I'm not convinced yet it's the way to do it - we can get (1) and (2) in first and then work through (3) and (4).
For example, it looks like we need to just use the DependencyParser class instead of the TemplateParser class to do the dependency identifcation. Can you get a TemplateParser from a DependencyParser? Should we have the compiler
(1) Create the dependency parser and identify order
(2) Create a TemplateParser (directly or via the DependencyParser) to do the parsing
(3) Get the generator and generate code
(2) and (3) of these steps are currently being done, but it looks like we may want to insert (1) before them.
6980ec0 to
ef5b3d5
Compare
sorry for the confusion.. |
twsouthwick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll say again that it would be simpler to break this into smaller changes so we can have some parts of this done.
Yeah, not sure what I meant there 😕 |
test/Compiler.Dynamic.Tests/assets/testForUserControl/TestUserControl.ascx.cs
Show resolved
Hide resolved
| <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestUserControl.ascx.cs" Inherits="SystemWebUISample.TestUserControl" %> | ||
| <%@ Register Src="~/InsideTestUserControl.ascx" TagPrefix="ucInside" TagName="InnerTestUserControl" %> | ||
|
|
||
| <div id="socialLoginList"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw can you simplify this control? we don't need it to do so much when all we want is a basic user control
93ff271 to
61dd72d
Compare
61dd72d to
9314cac
Compare
twsouthwick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking much better. A couple smaller things and then we're good to merge.
0357fe5 to
536f2fa
Compare
twsouthwick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. There's a few issues we've created as follow up, but let's get this in so we have user controls
Thank you.. lots of learning.. |
This change will enable user control compilation/rendering etc inside the CoreWebForm . Fixing issue #19